NLL fails to suggest "try removing &mut here" by davidtwco · Pull Request #54720 · rust-lang/rust (original) (raw)

r=me but the incremental tests are unhappy. Looks like the test just needs to be updated though. You probably just need to change

#[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] trait TraitChangeModeSelfOwnToMut: Sized { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] fn method(mut self) {} }

to

#[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] trait TraitChangeModeSelfOwnToMut: Sized { #[rustc_dirty(label="Hir", cfg="cfail2")] // changed! #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] fn method(mut self) {} }

In particular, in the old system, the Hir didn't reflect the mut in the signature, but now it does.