Skip to content

Commit 2ce0627

Browse files
tests: adds cargo fix tests
Co-Developed-by: Eric Holk Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
1 parent f85f7af commit 2ce0627

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ compile-flags: --edition=2021
2+
// This test ensures that expr_2021 is not allowed on pre-2021 editions
3+
#![deny(edition_2024_expr_fragment_specifier)]
4+
5+
macro_rules! m {
6+
($e:expr) => { //~ ERROR: the `expr` fragment specifier will accept more expressions in the 2024 edition.
7+
//~^ WARN: this changes meaning in Rust 2024
8+
$e
9+
};
10+
}
11+
12+
fn main() {
13+
m!(());
14+
}
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: the `expr` fragment specifier will accept more expressions in the 2024 edition.
2+
--> $DIR/expr_2021_cargo_fix_edition.rs:6:9
3+
|
4+
LL | ($e:expr) => {
5+
| ^^^^
6+
|
7+
= warning: this changes meaning in Rust 2024
8+
= note: for more information, see issue #123742 <https://github.com/rust-lang/rust/issues/123742>
9+
note: the lint level is defined here
10+
--> $DIR/expr_2021_cargo_fix_edition.rs:3:9
11+
|
12+
LL | #![deny(edition_2024_expr_fragment_specifier)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
help: to keep the existing behavior, use the `expr_2021` fragment specifier.
15+
|
16+
LL | ($e:expr_2021) => {
17+
| ~~~~~~~~~
18+
19+
error: aborting due to 1 previous error
20+

0 commit comments

Comments
 (0)