-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test that expr_2021 only works on 2024 edition
Co-authored-by: Vincenzo Palazzo <[email protected]>
- Loading branch information
1 parent
256f802
commit 0777912
Showing
2 changed files
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//@ compile-flags: --edition=2021 | ||
|
||
// This test ensures that expr_2021 is not allowed on pre-2024 editions | ||
|
||
macro_rules! m { | ||
($e:expr_2021) => { //~ ERROR: invalid fragment specifier `expr_2021` | ||
$e | ||
}; | ||
} | ||
|
||
fn main() { | ||
m!(()); //~ ERROR: no rules expected the token `(` | ||
} |
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,25 @@ | ||
error: invalid fragment specifier `expr_2021` | ||
--> $DIR/expr_2021_old_edition.rs:6:6 | ||
| | ||
LL | ($e:expr_2021) => { | ||
| ^^^^^^^^^^^^ | ||
| | ||
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` | ||
|
||
error: no rules expected the token `(` | ||
--> $DIR/expr_2021_old_edition.rs:12:8 | ||
| | ||
LL | macro_rules! m { | ||
| -------------- when calling this macro | ||
... | ||
LL | m!(()); | ||
| ^ no rules expected this token in macro call | ||
| | ||
note: while trying to match meta-variable `$e:ident` | ||
--> $DIR/expr_2021_old_edition.rs:6:6 | ||
| | ||
LL | ($e:expr_2021) => { | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|