Helpful suggestions for incorrect address-of mutability - #160897
Helpful suggestions for incorrect address-of mutability#160897TirushOne wants to merge 1 commit into
Conversation
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Could you add a test case for |
|
Reminder, once the PR becomes ready for a review, use |
|
This code: fn takes_raw(_: *mut String) {}
fn main() {
let mut value = String::new();
takes_raw(&value);
}we can also suggest also please git squash the commits. |
the wrong mutability to a function.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
44edf43 to
a5bbf02
Compare
|
I made a dogs breakfast out of the git history for this PR, instead of untangling it I created a new PR with the suggested changes and assigned you to it @petrochenkov. You can find it here as #162106. |
Added suggestions for
&and&rawexpressions used as function arguments when the function expects a mutable address.I also did a small refactor, grouping all 'suggest mut' code into a single function called
suggest_addr_mut, and removedsuggest_ptr_null_mut. Its logic was moved into the newsuggest_addr_mut.Fixes #159490.
Example:
Diagnostics before:
Diagnostics after: