File tree 2 files changed +9
-14
lines changed
2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change 1
1
//@ edition: 2021
2
-
3
- #![ feature( macro_metavar_expr) ]
4
-
5
2
#[ macro_export]
6
3
macro_rules! make_matcher {
7
- ( $name: ident, $fragment_type: ident) => {
4
+ ( $name: ident, $fragment_type: ident, $d : tt ) => {
8
5
#[ macro_export]
9
6
macro_rules! $name {
10
- ( $$ _: $fragment_type) => { true } ;
11
- ( $$ ( $$_ : tt ) * ) => { false } ;
7
+ ( $d _: $fragment_type) => { true } ;
8
+ ( const { 0 } ) => { false } ;
12
9
}
13
- }
10
+ } ;
14
11
}
15
-
16
- make_matcher ! ( is_expr_from_2021, expr) ;
12
+ make_matcher ! ( is_expr_from_2021, expr, $) ;
Original file line number Diff line number Diff line change 2
2
//@ aux-build: metavar_2021.rs
3
3
//@ run-pass
4
4
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.
6
7
7
8
#![ feature( expr_fragment_specifier_2024) ]
8
9
#![ feature( macro_metavar_expr) ]
@@ -12,7 +13,7 @@ extern crate metavar_2021;
12
13
13
14
use metavar_2021:: { is_expr_from_2021, make_matcher} ;
14
15
15
- make_matcher ! ( is_expr_from_2024, expr) ;
16
+ make_matcher ! ( is_expr_from_2024, expr, $ ) ;
16
17
17
18
fn main ( ) {
18
19
let from_2021 = is_expr_from_2021 ! ( const { 0 } ) ;
@@ -21,9 +22,7 @@ fn main() {
21
22
dbg ! ( from_2024) ;
22
23
23
24
// 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.
27
26
assert ! ( !from_2021) ;
28
27
assert ! ( !from_2024) ;
29
28
}
You can’t perform that action at this time.
0 commit comments