You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ rustc - <<<'fn main() { let ref (); }'<anon>:1:17: 1:20 error: expected identifier, found path
<anon>:1 fn main() { letref (); }
^~~
$ rustc - <<<'fn main() { let mut _; }'<anon>:1:17: 1:20 error: expected identifier, found path
<anon>:1 fn main() { let mut _; }
^~~
$ rustc - <<<'fn main() { let ref mut 1; }'<anon>:1:21: 1:24 error: expected identifier, found path
<anon>:1 fn main() { let ref mut 1; }
^~~
The error snake isn't on the right token (since the problem is the ()/_/1 not being an identifier, not the ref/mut), and there's no path in any of the examples, but all the error messages complain about it.
In contrast, a different pattern gives a reasonable error message:
$ rustc - <<<'fn main() { let ref mut A(_); }'<anon>:1:25: 1:26 error: expected identifier, found enum pattern
<anon>:1 fn main() { let ref mut A(_); }
^
(although theoretically the error snake should cover the whole enum pattern, given it's actually pointing at an identifier there.)
The text was updated successfully, but these errors were encountered:
This updates the `unused` lint group to include more lints, updates the `non_snake_case` lint to give better suggestions, adds a note explaining why a lifetime cannot be elided, and tweaks various error messages. This also updates the `non_uppercase_statics` lint to be warn-by-default to match the other naming lints. For statics, this lint is particularly useful, because a non-uppercase static can easily collide with a pattern binding, resulting in very confusing errors.
Closes#15914.
Closes#15657.
Closes#17337.
ftxqxd
added a commit
to ftxqxd/rust
that referenced
this issue
Oct 3, 2014
The error snake isn't on the right token (since the problem is the
()
/_
/1
not being an identifier, not theref
/mut
), and there's no path in any of the examples, but all the error messages complain about it.In contrast, a different pattern gives a reasonable error message:
(although theoretically the error snake should cover the whole enum pattern, given it's actually pointing at an identifier there.)
The text was updated successfully, but these errors were encountered: