I meant to type
let mut a = ['1','2','3'];
but I left off the ' after the 2 and got an error message about lifetimes. It makes sense, but in context, it might be useful to warn about a missing quote.
I meant to type
let mut a = ['1','2','3'];
but I left off the ' after the 2 and got an error message about lifetimes. It makes sense, but in context, it might be useful to warn about a missing quote.
Probably worth filing a diagnostics bug against rust-lang/rust!
For context for other readers, the error message is
error: lifetimes cannot start with a number
--> src/main.rs:2:22
|
2 | let mut a = ['1','2,'3'];
| ^^
error: expected `while`, `for`, `loop` or `{` after a label
--> src/main.rs:2:24
|
2 | let mut a = ['1','2,'3'];
| ^ expected `while`, `for`, `loop` or `{` after a label
which is not necessarily the most typical thing that I would call an "error about lifetimes" but rather an "error about lifetimes syntax", but adding some help
mentioning character literals seems useful nonetheless, for both of the error messages above (in particular the second one since that second error is only error you get in case the char isn't a number but a letter, i. e. a syntactically valid lifetime or label).
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.