Skip to content

Commit e07b011

Browse files
fixup! test: cross-edition metavar fragment specifiers
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 81b3c9f commit e07b011

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed
+5-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
//@ edition: 2021
2-
3-
#![feature(macro_metavar_expr)]
4-
52
#[macro_export]
63
macro_rules! make_matcher {
7-
($name:ident, $fragment_type:ident) => {
4+
($name:ident, $fragment_type:ident, $d:tt) => {
85
#[macro_export]
96
macro_rules! $name {
10-
($$_:$fragment_type) => { true };
11-
($$($$_:tt)*) => { false };
7+
($d _:$fragment_type) => { true };
8+
(const { 0 }) => { false };
129
}
13-
}
10+
};
1411
}
15-
16-
make_matcher!(is_expr_from_2021, expr);
12+
make_matcher!(is_expr_from_2021, expr, $);

tests/ui/macros/expr_2021_with_metavar_expr.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//@ aux-build: metavar_2021.rs
33
//@ run-pass
44

5-
// This test captures the behavior of macro-generating-macros with fragment specifiers across edition b
5+
// This test captures the behavior of macro-generating-macros with fragment
6+
// specifiers across edition boundaries.
67

78
#![feature(expr_fragment_specifier_2024)]
89
#![feature(macro_metavar_expr)]
@@ -12,7 +13,7 @@ extern crate metavar_2021;
1213

1314
use metavar_2021::{is_expr_from_2021, make_matcher};
1415

15-
make_matcher!(is_expr_from_2024, expr);
16+
make_matcher!(is_expr_from_2024, expr, $);
1617

1718
fn main() {
1819
let from_2021 = is_expr_from_2021!(const { 0 });
@@ -21,9 +22,7 @@ fn main() {
2122
dbg!(from_2024);
2223

2324
// These capture the current, empirically determined behavior.
24-
//
25-
// It's not clear whether this is the desired behavior, but that's a
26-
// question we can deal with when stabilizing macro_metavar_expr.
25+
// It's not clear whether this is the desired behavior.
2726
assert!(!from_2021);
2827
assert!(!from_2024);
2928
}

0 commit comments

Comments
 (0)