forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce that raw lifetime identifiers must be valid raw identifiers
- Loading branch information
1 parent
1e4f10b
commit 9785c7c
Showing
5 changed files
with
72 additions
and
4 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
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,20 @@ | ||
//@ edition: 2021 | ||
|
||
// Reject raw lifetimes with identifier parts that wouldn't be valid raw identifiers. | ||
|
||
macro_rules! w { | ||
($tt:tt) => {}; | ||
} | ||
|
||
w!('r#_); | ||
//~^ ERROR `_` cannot be a raw lifetime | ||
w!('r#self); | ||
//~^ ERROR `self` cannot be a raw lifetime | ||
w!('r#super); | ||
//~^ ERROR `super` cannot be a raw lifetime | ||
w!('r#Self); | ||
//~^ ERROR `Self` cannot be a raw lifetime | ||
w!('r#crate); | ||
//~^ ERROR `crate` cannot be a raw lifetime | ||
|
||
fn main() {} |
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,32 @@ | ||
error: `_` cannot be a raw lifetime | ||
--> $DIR/raw-lt-invalid-raw-id.rs:9:4 | ||
| | ||
LL | w!('r#_); | ||
| ^^^^ | ||
|
||
error: `self` cannot be a raw lifetime | ||
--> $DIR/raw-lt-invalid-raw-id.rs:11:4 | ||
| | ||
LL | w!('r#self); | ||
| ^^^^^^^ | ||
|
||
error: `super` cannot be a raw lifetime | ||
--> $DIR/raw-lt-invalid-raw-id.rs:13:4 | ||
| | ||
LL | w!('r#super); | ||
| ^^^^^^^^ | ||
|
||
error: `Self` cannot be a raw lifetime | ||
--> $DIR/raw-lt-invalid-raw-id.rs:15:4 | ||
| | ||
LL | w!('r#Self); | ||
| ^^^^^^^ | ||
|
||
error: `crate` cannot be a raw lifetime | ||
--> $DIR/raw-lt-invalid-raw-id.rs:17:4 | ||
| | ||
LL | w!('r#crate); | ||
| ^^^^^^^^ | ||
|
||
error: aborting due to 5 previous errors | ||
|