Skip to content
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

Identify incorrect lifetimes using a number as identifier in the parser #58786

Closed
estebank opened this issue Feb 27, 2019 · 0 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions A-parser Area: The parsing of Rust source code to an AST A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`

Comments

@estebank
Copy link
Contributor

error: character literal may only contain one codepoint
 --> src/main.rs:1:10
  |
1 | struct S<'1> { s: &'1 usize }
  |          ^^^^^^^^^^^
help: if you meant to write a `str` literal, use double quotes
  |
1 | struct S<"1> { s: &"1 usize }
  |          ^^^^^^^^^^^

error: unexpected close delimiter: `}`
 --> src/main.rs:1:29
  |
1 | struct S<'1> { s: &'1 usize }
  |                             ^ unexpected close delimiter

should instead be

error: lifetimes must be valid identifiers, not a numberic
 --> src/main.rs:1:10
  |
1 | struct S<'1> { s: &'1 usize }
  |          ^^        ^^ numbers are not a valid lifetime identifier
  |          |
  |          numbers are not a valid lifetime identifier
help: if you meant to write a valid lifetime, use a valid identifier
  |
1 | struct S<'a> { s: &'a usize }
  |          ^^        ^^
@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions A-parser Area: The parsing of Rust source code to an AST A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Feb 27, 2019
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
Centril added a commit to Centril/rust that referenced this issue Mar 11, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
kennytm added a commit to kennytm/rust that referenced this issue Mar 11, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Mar 12, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
Centril added a commit to Centril/rust that referenced this issue Mar 13, 2019
…henkov

Parse lifetimes that start with a number and give specific error

Fix rust-lang#58786.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions A-parser Area: The parsing of Rust source code to an AST A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`
Projects
None yet
Development

No branches or pull requests

1 participant