-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest dereferencing LHS of assignment operator #93575
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
Closed
compiler-errors
wants to merge
2
commits into
rust-lang:master
from
compiler-errors:deref-on-assign-lhs
Closed
Suggest dereferencing LHS of assignment operator #93575
compiler-errors
wants to merge
2
commits into
rust-lang:master
from
compiler-errors:deref-on-assign-lhs
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
The job Click to see the possible cause of the failure (guessed by this bot)
|
haha, forgot to consider the deref=0 case. let me fix that when i wake up tomorrow. @rustbot author |
Actually this is already covered in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Putting this diagnostic up for consideration, since I was dissatisfied with the unhelpful error message after I fixed the bug in #93574.
This suggestion isn't always correct, but it seems like many of our diagnostics are not, and it should be correct in simple cases. My only wish is that there were an
FnCtxt::autoderef
that only suggestedDerefMut
implementations so we can get the mutability correct...Also I had to split the
check_expr_coercable_to_type
intocheck_expr_with_hint
anddemand_coerce_diag
so I could delay emitting the coercion error, but that's basically what the former was doing in the first place. Let me know if I should refactor some of this logic into a helper fn.