-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix suggestion on DerefMut #71389
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
Comments
@estebank Do you have any mentor instructions for this? I did asked in discord once but you said go ahead. If not I would need to grep myself. :D |
Searching for
Looking on its body, you can see how we suggest borrowing (in this case we would want to check the opposite): rust/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs Lines 457 to 511 in b218b95
I don't know if we will be able to provide a structured suggestion, because to do so we would need to have some way of recovering the enclosing expression to identify it is an assignment, and from knowing the type we could suggest |
I tried this code:
I expected to see this happen: Suggestion of
*n = ...
, the correct code would beInstead, this happened: It did not look at mutable deref value and directly show the suggestion
Not sure why but I miss
*
quite often. Link to playground https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=011e594936166764d011c581d7db107eMeta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: