File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,4 +31,12 @@ fn main() {
3131 //~^ mut_mut
3232 * * * y + * * x;
3333 }
34+
35+ if fun ( x) {
36+ // The lint will remove the extra `&mut`, but the result will still be a `&mut` of an expr
37+ // of type `&mut _` (x), so the lint will fire again. That's because we've decided that
38+ // doing both fixes in one run is not worth it, given how improbable code like this is.
39+ let y = & mut & mut x;
40+ //~^ mut_mut
41+ }
3442}
Original file line number Diff line number Diff line change @@ -31,5 +31,11 @@ error: an expression of form `&mut &mut _`
3131LL | let y = &mut &mut &mut 2;
3232 | ^^^^^^^^^^^^^^^^ help: remove the extra `&mut`s: `&mut 2`
3333
34- error: aborting due to 5 previous errors
34+ error: an expression of form `&mut &mut _`
35+ --> tests/ui/mut_mut_unfixable.rs:39:17
36+ |
37+ LL | let y = &mut &mut x;
38+ | ^^^^^^^^^^^ help: remove the extra `&mut`: `&mut x`
39+
40+ error: aborting due to 6 previous errors
3541
You can’t perform that action at this time.
0 commit comments