Skip to content

Commit 6366acc

Browse files
tests: adds cargo fix tests
Co-Developed-by: Eric Holk Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent cb9f55c commit 6366acc

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ run-rustfix
2+
//@ check-pass
3+
//@ compile-flags: --edition=2021
4+
#![allow(incomplete_features)]
5+
#![feature(expr_fragment_specifier_2024)]
6+
#![warn(edition_2024_expr_fragment_specifier)]
7+
8+
macro_rules! m {
9+
($e:expr_2021) => { //~ WARN: the `expr` fragment specifier will accept more expressions in the 2024 edition.
10+
//~^ WARN: this changes meaning in Rust 2024
11+
$e
12+
};
13+
($($i:expr_2021)*) => { }; //~ WARN: the `expr` fragment specifier will accept more expressions in the 2024 edition.
14+
//~^ WARN: this changes meaning in Rust 2024
15+
}
16+
17+
fn main() {
18+
m!(());
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ run-rustfix
2+
//@ check-pass
3+
//@ compile-flags: --edition=2021
4+
#![allow(incomplete_features)]
5+
#![feature(expr_fragment_specifier_2024)]
6+
#![warn(edition_2024_expr_fragment_specifier)]
7+
8+
macro_rules! m {
9+
($e:expr) => { //~ WARN: the `expr` fragment specifier will accept more expressions in the 2024 edition.
10+
//~^ WARN: this changes meaning in Rust 2024
11+
$e
12+
};
13+
($($i:expr)*) => { }; //~ WARN: the `expr` fragment specifier will accept more expressions in the 2024 edition.
14+
//~^ WARN: this changes meaning in Rust 2024
15+
}
16+
17+
fn main() {
18+
m!(());
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
warning: the `expr` fragment specifier will accept more expressions in the 2024 edition.
2+
--> $DIR/expr_2021_cargo_fix_edition.rs:9:9
3+
|
4+
LL | ($e:expr) => {
5+
| ^^^^
6+
|
7+
= warning: this changes meaning in Rust 2024
8+
= note: for more information, see Migration Guide <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html>
9+
note: the lint level is defined here
10+
--> $DIR/expr_2021_cargo_fix_edition.rs:6:9
11+
|
12+
LL | #![warn(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+
warning: the `expr` fragment specifier will accept more expressions in the 2024 edition.
20+
--> $DIR/expr_2021_cargo_fix_edition.rs:13:11
21+
|
22+
LL | ($($i:expr)*) => { };
23+
| ^^^^
24+
|
25+
= warning: this changes meaning in Rust 2024
26+
= note: for more information, see Migration Guide <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html>
27+
help: to keep the existing behavior, use the `expr_2021` fragment specifier.
28+
|
29+
LL | ($($i:expr_2021)*) => { };
30+
| ~~~~~~~~~
31+
32+
warning: 2 warnings emitted
33+

0 commit comments

Comments
 (0)