-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
NLL diagnostics span RHS of assignment when LHS was prior (and better?) choice #51217
Comments
So
|
I personally like the option of "Check if the variable starts initialized, and use the span from the variable's declaration instead of from the assignment." In particular, I'm already extending So it seems natural to me to include information like: Is there an explicit type attached? (if so, what is its span?), and is there an initialization expression (and if so, what is its span)? |
(Adding such info as mentioned in my previous comment to |
I'm marking this as RC -- it seems not that criticial. |
Well, it is somewhat wrong. I'm going to put it as EP. |
But if we can't find a nice fix, oh well. |
…r=nikomatsakis [NLL] Use better span for initializing a variable twice Closes rust-lang#51217 When assigning to a (projection from a) local immutable local which starts initialised (everything except `let PATTERN;`): * Point to the declaration of that local * Make the error message refer to the local, rather than the projection. r? @nikomatsakis
[NLL] Use better span for initializing a variable twice Closes #51217 When assigning to a (projection from a) local immutable local which starts initialised (everything except `let PATTERN;`): * Point to the declaration of that local * Make the error message refer to the local, rather than the projection. r? @nikomatsakis
Consider the output diagnostics from
rust/src/test/ui/command-line-diagnostics.nll.stderr
Lines 4 to 5 in 746d63a
and compare them to
rust/src/test/ui/command-line-diagnostics.stderr
Lines 4 to 5 in 746d63a
I don't know why NLL deviates.
(Maybe its fine to switch to the right-hand side, but I want to make sure we do so as a deliberate choice, not an accident.)
The text was updated successfully, but these errors were encountered: