-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
"immutable field" errors are confusing when the handle is mutable, should describe why it is immutable #18150
Comments
Triage: same problem, but some updated code:
|
Triage: no change |
Related: #47774. |
Current output:
|
Current output:
|
Case from #52941:
|
If I understand correctly, it seems like the main thing that is currently missing from the desiderata here is something in the diagnostic connecting the |
I'll nominate this for discussion at the T-compiler meeting: I do not think the P-high tag is warranted (it was added to this issue based on feedback in #52941), but I want to make sure we at least discuss this issue as a group before I revise its priority. |
Gives no indication that the field is immutable because it is stored inside an
Rc
/&
. These example are somewhat obvious, since the initialiser is directly above, but it's certainly possible to be matching deep inside some data structure and meet this error even though there aremut
s on all the appropriate variables.The error message could include: "note: this field is immutable because it is being accessed via an
&
reference [created by the autoderef of aRc
]".The text was updated successfully, but these errors were encountered: