Skip to content

Commit ee4395b

Browse files
committed
Add test raw-underscore-lifetime.rs
Signed-off-by: xizheyin <[email protected]>
1 parent f191420 commit ee4395b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test is to ensure that the raw underscore lifetime won't emit two duplicate errors.
2+
// See issue #143152
3+
4+
//@ edition: 2021
5+
6+
fn f<'r#_>(){}
7+
//~^ ERROR `_` cannot be a raw lifetime
8+
//~| ERROR `'_` cannot be used here [E0637]
9+
10+
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: `_` cannot be a raw lifetime
2+
--> $DIR/raw-underscore-lifetime.rs:6:6
3+
|
4+
LL | fn f<'r#_>(){}
5+
| ^^^^
6+
7+
error[E0637]: `'_` cannot be used here
8+
--> $DIR/raw-underscore-lifetime.rs:6:6
9+
|
10+
LL | fn f<'r#_>(){}
11+
| ^^^^ `'_` is a reserved lifetime name
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0637`.

0 commit comments

Comments
 (0)