Skip to content

Commit 50d1efa

Browse files
committedJun 19, 2024
Add a test demonstrating the problem
1 parent 894f7a4 commit 50d1efa

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ edition:2021
2+
3+
#[macro_export]
4+
macro_rules! m {
5+
($expr:expr) => {
6+
compile_error!("did not expect an expression to be parsed");
7+
};
8+
(const { }) => {};
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ compile-flags: --edition=2024 -Zunstable-options
2+
//@ aux-build:expr_2021_implicit.rs
3+
4+
extern crate expr_2021_implicit;
5+
6+
// Makes sure that a `:expr` fragment matcher defined in a edition 2021 crate
7+
// still parses like an `expr_2021` fragment matcher in a 2024 user crate.
8+
expr_2021_implicit::m!(const {});
9+
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: did not expect an expression to be parsed
2+
--> $DIR/expr_2021_implicit_in_2024.rs:8:1
3+
|
4+
LL | expr_2021_implicit::m!(const {});
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: this error originates in the macro `expr_2021_implicit::m` (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+
error: aborting due to 1 previous error
10+

0 commit comments

Comments
 (0)