-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unclear error E0594 #52941
Comments
Additional note : it's not just a problem with the error message of E0594, since the same error is also raised when it's actually a immutable binding problem :
It should just be another error kind raised in the situation described by this issue. (And also E0594 should probably appear in the error index and as a result of |
I think NLL does a better job with error message here. Look at the output when you run with 2018 edition enabled (playground):
|
(as in, it may be reasonable to tag this as NLL-fixed-by-NLL...) |
Likewise, here's what NLL does for the second provided example (playground):
which I think also satisfies the request written in the comment above? |
You're right, that's way better with NLL ! I'm a bit surprised that enabling 2018 edition activates NLL: does that mean that NLL will be limited to the 2018 edition ? |
That also means that with NLL, the meaning a E0594 is changing (from «immutable binding error» also triggered in case of «immutable reference error» to «immutable reference error» only). |
No, not in the long term. For the short term, we are connecting the enabling of NLL to the 2018 edition as a way to try to get it tested by people who are willing to deal with the headaches NLL might imply in its current state.
In the long term, we are planning to move everybody to NLL, regardless of edition. The schedule for when that will happen hasn't been established yet; I suspect it will depend on the feedback we get from 2018 edition preview 2.
|
Thanks for your answers. I think I can close the issue. |
I just want to chime in – I found
Can we hope for a clearer error message than |
I'm re-opening this issue because of what @dustinfreeman said, and because E0594 is still not part of the error index. |
agreed, this would be helpful, as I've found myself last couple of days falling to find it. |
reopening as the modern, more narrowly focused version of #18150 (though really, an entirely new issue might be warranted at this point, to avoid the discussion of NLL and what not...) |
marking P-high to reflect desired prioritization of @estebank , and assigning to self. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Note that as of January 2020, this E0594 still is not part of the error index. |
@Qqwy that work is tracked in #61137. This error code has been added to the index. |
When attempting to mutate a field of a borrowed struct (with a shared reference
&
) we get the unhelpful E5094 error :Sample code :
Error :
Since the compiler complains about a “binding” being immutable, my reflex was to add a
mut
atfoo
's declaration site :Which didn't change anything. (except adding a warning that I didn't notice)
The problem here, is that the error message is complaining about an immutable binding whereas it should complain about an immutable (or shared) reference.
To add insult to injury, the error E0594 doesn't exist in the error index and
rustc --explain E0594
returns the laconicMeta
rustc --version --verbose
:rustc 1.29.0-nightly (e94df4a 2018-07-31)
binary: rustc
commit-hash: e94df4a
commit-date: 2018-07-31
host: x86_64-unknown-linux-gnu
release: 1.29.0-nightly
LLVM version: 7.0
The behavior is the same on Stable 1.27.2 though.
The text was updated successfully, but these errors were encountered: