-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Remove asterisk suggestion for move errors in borrowck #61332
Remove asterisk suggestion for move errors in borrowck #61332
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
I see that the build has failed because the stderr output for some tests in the |
You can update the files by running |
Thanks! Did that, and now there are some tests running https://gist.github.com/kennethbgoodin/d43178144e121e9cf8ca07cca079b171 |
There's no automated way to fix those. You'll have to manually remove |
Okay thank you, on it. |
ebb39b1
to
5fcc753
Compare
Okay tests passed 😄 |
5fcc753
to
f4e01aa
Compare
Applicability::Unspecified, | ||
); | ||
} else { | ||
if !try_remove_deref || !snippet.starts_with('*') { |
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.
I think this condition should be removed and we should accept that sometimes we will suggest &*
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.
I've made that change. You said we should accept that sometimes we will suggest strange things, but it's worth highlighting some of the weirder:
132aa6d#diff-33c6ee1b44f5207df102942b0c659b94R26
132aa6d#diff-a3121673048182c8d1a0ee3ccbfb9d5fR8
Are those suggestions acceptable? They might end up causing more confusion than the initial suggestion this PR addresses.
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.
The first is fine. The &*&
suggestions are weird, but they need someone to write *&
. I think that we are generally OK with suggestions that are suboptimal in edge cases. cc @rust-lang/wg-diagnostics
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.
It'd be nice to add the comment // run-rustfix
at the beginning of the changed tests (and rerun x.py
) to make sure the suggestions are always valid in these cases and do not break going forwards.
I think that we are generally OK with suggestions that are suboptimal in edge cases.
We have a harder stance on incorrect and misleading suggestions over weird suggestions, but we do try to minimize the later :)
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.
Suggestions from borrow checking are always going to be best guesses. They definitely shouldn't be rustfixable, unless rustfix has a flag to apply possibly incorrect suggestions.
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.
Hi, just wanted to confirm -- I should not do Esteban's suggestion?
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.
@kennethbgoodin it's fine, don't bother for now. I'll try to clean it up sometime down the line :)
f4e01aa
to
132aa6d
Compare
This comment has been minimized.
This comment has been minimized.
As per issue rust-lang#54985 removes the not useful suggestion to remove asterisk in move errors. Includes minor changes to tests in the `ui` suite to account for the removed suggestion.
132aa6d
to
de677b9
Compare
@bors r+ |
📌 Commit de677b9 has been approved by |
…risk-suggestion, r=matthewjasper Remove asterisk suggestion for move errors in borrowck As per the decision in rust-lang#54985 completely removes the suggestion to add an asterisk when checking move errors. I believe I've preserved the correct behavior with the "consider borrowing here" branch of the original match arm, but I'm not positive on that. This is my first PR to rustc so any feedback is greatly appreciated. Thanks.
Rollup of 4 pull requests Successful merges: - #61332 (Remove asterisk suggestion for move errors in borrowck) - #61532 ([const-prop] Support Rvalue::{Ref,Len} and Deref) - #61586 (ci: Disable LLVM/debug assertions for asmjs builder) - #61599 (libcore/pin: Minor grammar corrections for module documentation) Failed merges: r? @ghost
⌛ Testing commit de677b9 with merge 6628785855a797d65c9fbab3930233d2fed11191... |
…risk-suggestion, r=matthewjasper Remove asterisk suggestion for move errors in borrowck As per the decision in rust-lang#54985 completely removes the suggestion to add an asterisk when checking move errors. I believe I've preserved the correct behavior with the "consider borrowing here" branch of the original match arm, but I'm not positive on that. This is my first PR to rustc so any feedback is greatly appreciated. Thanks.
@bors retry r0lled up |
Rollup of 7 pull requests Successful merges: - #61332 (Remove asterisk suggestion for move errors in borrowck) - #61532 ([const-prop] Support Rvalue::{Ref,Len} and Deref) - #61586 (ci: Disable LLVM/debug assertions for asmjs builder) - #61599 (libcore/pin: Minor grammar corrections for module documentation) - #61603 (Increases heap size available during testing for SGX) - #61605 (Fix slice const generic length display) - #61618 (make the backtrace field of EvalError private) Failed merges: r? @ghost
As per the decision in #54985 completely removes the suggestion to add an asterisk when checking move errors. I believe I've preserved the correct behavior with the "consider borrowing here" branch of the original match arm, but I'm not positive on that.
This is my first PR to rustc so any feedback is greatly appreciated. Thanks.