Closed
Description
$ rustc - <<< 'fn main() { let ref (); }'
<anon>:1:17: 1:20 error: expected identifier, found path
<anon>:1 fn main() { let ref (); }
^~~
$ 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.)