-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E0596 should suggest changing type if it suggest taking taking mutable reference instead of just reference #106857
Comments
I think we can use the same strategy we use here https://github.com/rust-lang/rust/pull/106360/files#diff-aef5d12ac7ec2060165cf1db78128f941c789bb2fc90c7ed351049b0be4d435eR1361-R1378, to turn spans into HIR nodes we can operate on, in rust/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs Lines 1161 to 1198 in c825459
The current output for the second case after applying the suggestion does guide you in the right direction, but ideally we won't need it in the future:
|
Hmm, I'll have a go at this. @rustbot claim |
…stebank tweak "make mut" spans when assigning to locals Work towards fixing rust-lang#106857 This PR just cleans up a lot of spans which is helpful before properly fixing the issues. Best reviewed commit-by-commit. r? `@estebank`
Given the following code:
The current output is:
If we apply the suggestion this will cause the next problem, because
&mut[1,2...]
is not&[isize]
but&mut [isize]
🙃so we should suggest
let x: &mut [isize] = &mut [1, 2, 3, 4, 5];
right away, if possible.The text was updated successfully, but these errors were encountered: