-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
borrowck: do not suggest to change "&mut self" to "&mut mut self" #33319
Conversation
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
This would prevent the following correct suggestion:
It might be a good idea to match the AST node so that we can continue providing the suggestion in the above case. It would be even better if we could provide the above That being said, I think it's more important to not provide a bad suggestion in the common case of |
I've looked a bit at what would be involved, and it's tricky: the "pat" node I can get only ever spans the "self" (it's the special pseudo node added by But I've rebased and added a test, will push that now. |
Matching the snippet string might not be the cleanest, but matching the AST node instead seems to end in a lot of nested `if let`s... Fixes rust-lang#31424.
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// forbid-output: &mut mut self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice -- I didn't know about forbid-output
@bors r+ |
📌 Commit fef8276 has been approved by |
borrowck: do not suggest to change "&mut self" to "&mut mut self" Matching the snippet string might not be the cleanest, but matching the AST node instead seems to end in a lot of nested `if let`s, so I don't know what's better. Of course it's entirely possible that there is another API altogether that I just don't know of? Fixes #31424.
Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested
if let
s, so Idon't know what's better.
Of course it's entirely possible that there is another API altogether
that I just don't know of?
Fixes #31424.