mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-08 04:56:58 +00:00
Add a test demonstrating the problem
This commit is contained in:
parent
894f7a4ba6
commit
50d1efa3e2
9
tests/ui/macros/auxiliary/expr_2021_implicit.rs
Normal file
9
tests/ui/macros/auxiliary/expr_2021_implicit.rs
Normal 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 { }) => {};
|
||||
}
|
10
tests/ui/macros/expr_2021_implicit_in_2024.rs
Normal file
10
tests/ui/macros/expr_2021_implicit_in_2024.rs
Normal 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() {}
|
10
tests/ui/macros/expr_2021_implicit_in_2024.stderr
Normal file
10
tests/ui/macros/expr_2021_implicit_in_2024.stderr
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user