Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure Current suggestion for when taking a mutable reference to `self` in a closure (as an upvar) will produce a machine-applicable suggestion to change the `self` in the function signature to `mut self`, but does not account for the specialness of implicit self in that it can already have `&` and `&mut` (see #111554). This causes the function signature to become `test(&mut mut self)` which does not seem desirable. ``` error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> src/sound_player.rs:870:11 | 869 | pub fn test(&mut self) { | ---- help: consider changing this to be mutable: `mut self` 870 | || test2(&mut self); | ^^^^^^^^^ cannot borrow as mutable ``` This PR suppresses the "changing this to be mutable" suggestion if the implicit self is either `ImplicitSelfKind::ImmRef` or `ImplicitSelfKind::MutRef`. Fixes #111554. |
||
|---|---|---|
| .. | ||
| bound_region_errors.rs | ||
| conflict_errors.rs | ||
| explain_borrow.rs | ||
| find_all_local_uses.rs | ||
| find_use.rs | ||
| mod.rs | ||
| move_errors.rs | ||
| mutability_errors.rs | ||
| outlives_suggestion.rs | ||
| region_errors.rs | ||
| region_name.rs | ||
| var_name.rs | ||