Add a test demonstrating the problem

This commit is contained in:
Michael Goulet 2024-06-19 12:33:25 -04:00
parent 894f7a4ba6
commit 50d1efa3e2
3 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,9 @@
//@ edition:2021
#[macro_export]
macro_rules! m {
($expr:expr) => {
compile_error!("did not expect an expression to be parsed");
};
(const { }) => {};
}

View file

@ -0,0 +1,10 @@
//@ compile-flags: --edition=2024 -Zunstable-options
//@ aux-build:expr_2021_implicit.rs
extern crate expr_2021_implicit;
// Makes sure that a `:expr` fragment matcher defined in a edition 2021 crate
// still parses like an `expr_2021` fragment matcher in a 2024 user crate.
expr_2021_implicit::m!(const {});
fn main() {}

View file

@ -0,0 +1,10 @@
error: did not expect an expression to be parsed
--> $DIR/expr_2021_implicit_in_2024.rs:8:1
|
LL | expr_2021_implicit::m!(const {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `expr_2021_implicit::m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 1 previous error