forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#58876 - estebank:numeric-lifetime, r=petroc…
…henkov Parse lifetimes that start with a number and give specific error Fix rust-lang#58786.
- Loading branch information
Showing
3 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
struct S<'1> { s: &'1 usize } | ||
//~^ ERROR lifetimes cannot start with a number | ||
//~| ERROR lifetimes cannot start with a number | ||
fn main() { | ||
// verify that the parse error doesn't stop type checking | ||
let x: usize = ""; | ||
//~^ ERROR mismatched types | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
error: lifetimes cannot start with a number | ||
--> $DIR/numeric-lifetime.rs:1:10 | ||
| | ||
LL | struct S<'1> { s: &'1 usize } | ||
| ^^ | ||
|
||
error: lifetimes cannot start with a number | ||
--> $DIR/numeric-lifetime.rs:1:20 | ||
| | ||
LL | struct S<'1> { s: &'1 usize } | ||
| ^^ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/numeric-lifetime.rs:6:20 | ||
| | ||
LL | let x: usize = ""; | ||
| ^^ expected usize, found reference | ||
| | ||
= note: expected type `usize` | ||
found type `&'static str` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |