Skip to content

Commit

Permalink
tests: adds cargo fix tests
Browse files Browse the repository at this point in the history
Co-Developed-by: Eric Holk
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed May 31, 2024
1 parent dab1dfe commit d11c856
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/ui/macros/expr_2021_cargo_fix_edition.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ compile-flags: --edition=2021
// This test ensures that expr_2021 is not allowed on pre-2021 editions
#![deny(edition_2024_expr_fragment_specifier)]

macro_rules! m {
($e:expr) => { //~ ERROR: the `expr` fragment specifier will accept more expressions in the 2024 edition.
//~^ WARN: this changes meaning in Rust 2024
$e
};
}

fn main() {
m!(());
}
20 changes: 20 additions & 0 deletions tests/ui/macros/expr_2021_cargo_fix_edition.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: the `expr` fragment specifier will accept more expressions in the 2024 edition.
--> $DIR/expr_2021_cargo_fix_edition.rs:6:9
|
LL | ($e:expr) => {
| ^^^^
|
= warning: this changes meaning in Rust 2024
= note: for more information, see issue #123742 <https://github.com/rust-lang/rust/issues/123742>
note: the lint level is defined here
--> $DIR/expr_2021_cargo_fix_edition.rs:3:9
|
LL | #![deny(edition_2024_expr_fragment_specifier)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to keep the existing behavior, use the `expr_2021` fragment specifier.
|
LL | ($e:expr_2021) => {
| ~~~~~~~~~

error: aborting due to 1 previous error

0 comments on commit d11c856

Please sign in to comment.