mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-02 09:47:57 +00:00
Helpful suggestions for incorrect address-of mutability (2) Added suggestions for & and &raw expressions used as function arguments when the function expects a mutable address. There is now also a suggestion for providing a &raw const/mut when a reference was expected, as well suggestions when & was used but the function expected *mut. I also did a small refactor, grouping all 'suggest mut' code into a single function called suggest_addr_mut, and removed suggest_ptr_null_mut. Its logic was moved into the new suggest_addr_mut. The test at tests\ui\span\coerce-suggestions.rs was updated to trigger all new diagnostics and blessed accordingly. Fixes: https://github.com/rust-lang/rust/issues/159490. This PR is mostly a clean-up of rust-lang/rust#160897, with an extra diagnostics thrown in at the suggestion of chenyukang. r? petrochenkov