-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid silencing of parsing error
Given ```rust macro_rules! a { ( ) => { impl<'b> c for d { e::<f'g> } }; } ``` ensure an error is emitted. Fix #123079.
- Loading branch information
Showing
7 changed files
with
80 additions
and
15 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
9 changes: 9 additions & 0 deletions
9
tests/ui/lexer/dont-ice-on-invalid-lifetime-in-macro-definition.rs
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,9 @@ | ||
//@ edition:2021 | ||
macro_rules! a { | ||
( ) => { | ||
impl<'b> c for d { | ||
e::<f'g> //~ ERROR prefix `f` is unknown | ||
} | ||
}; | ||
} | ||
fn main() {} |
14 changes: 14 additions & 0 deletions
14
tests/ui/lexer/dont-ice-on-invalid-lifetime-in-macro-definition.stderr
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,14 @@ | ||
error: prefix `f` is unknown | ||
--> $DIR/dont-ice-on-invalid-lifetime-in-macro-definition.rs:5:17 | ||
| | ||
LL | e::<f'g> | ||
| ^ unknown prefix | ||
| | ||
= note: prefixed identifiers and literals are reserved since Rust 2021 | ||
help: consider inserting whitespace here | ||
| | ||
LL | e::<f 'g> | ||
| + | ||
|
||
error: aborting due to 1 previous error | ||
|
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,9 @@ | ||
//@edition:2021 | ||
macro_rules! foo { | ||
() => { | ||
println!('hello world'); | ||
//~^ ERROR unterminated character literal | ||
//~| ERROR prefix `world` is unknown | ||
} | ||
} | ||
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,26 @@ | ||
error: prefix `world` is unknown | ||
--> $DIR/lex-bad-str-literal-as-char-4.rs:4:25 | ||
| | ||
LL | println!('hello world'); | ||
| ^^^^^ unknown prefix | ||
| | ||
= note: prefixed identifiers and literals are reserved since Rust 2021 | ||
help: if you meant to write a string literal, use double quotes | ||
| | ||
LL | println!("hello world"); | ||
| ~ ~ | ||
|
||
error[E0762]: unterminated character literal | ||
--> $DIR/lex-bad-str-literal-as-char-4.rs:4:30 | ||
| | ||
LL | println!('hello world'); | ||
| ^^^ | ||
| | ||
help: if you meant to write a string literal, use double quotes | ||
| | ||
LL | println!("hello world"); | ||
| ~ ~ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0762`. |