Files
rust/compiler
Jonathan Brouwer 05b6c8e92b Rollup merge of #162106 - TirushOne:addr-mutability-suggestions, r=jackh726
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
2026-10-09 22:06:56 +02:00
..
2026-10-08 16:05:48 +00:00