diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-06-29 21:05:19 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-07-01 15:29:29 +0500 |
| commit | f12120d2bd237ffbf03c8de027513a8d0bc63616 (patch) | |
| tree | 3350a7cbd9079d31f145865734ed4de151c91133 /tests/ui/fn/mutable-function-parameters.rs | |
| parent | 6ca9b43ea9f50d5e77dc0f8d4d62283017b3f1b0 (diff) | |
| download | rust-f12120d2bd237ffbf03c8de027513a8d0bc63616.tar.gz rust-f12120d2bd237ffbf03c8de027513a8d0bc63616.zip | |
cleaned up some tests
Diffstat (limited to 'tests/ui/fn/mutable-function-parameters.rs')
| -rw-r--r-- | tests/ui/fn/mutable-function-parameters.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/ui/fn/mutable-function-parameters.rs b/tests/ui/fn/mutable-function-parameters.rs index 01c264fce03..5045a783f04 100644 --- a/tests/ui/fn/mutable-function-parameters.rs +++ b/tests/ui/fn/mutable-function-parameters.rs @@ -1,3 +1,6 @@ +//! Test that function and closure parameters marked as `mut` can be mutated +//! within the function body. + //@ run-pass fn f(mut y: Box<isize>) { @@ -6,10 +9,12 @@ fn f(mut y: Box<isize>) { } fn g() { - let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); }; + let frob = |mut q: Box<isize>| { + *q = 2; + assert_eq!(*q, 2); + }; let w = Box::new(37); frob(w); - } pub fn main() { |
