Skip to content

Commit 2508e7c

Browse files
committedDec 2, 2024·
fix: metavariable 出现变更
close #13 ref: rust-lang/rust#122808
1 parent 9195678 commit 2508e7c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎src/decl-macros/minutiae/metavar-expr.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ bar!();
7878
7979
macro_rules! foo {
8080
( $( $outer:ident ( $( $inner:ident ),* ) ; )* ) => {
81-
println!("count(outer, 0): $outer repeats {} times", ${count(outer)});
82-
println!("count(inner, 0): The $inner repetition repeats {} times in the outer repetition", ${count(inner, 0)});
83-
println!("count(inner, 1): $inner repeats {} times in the inner repetitions", ${count(inner, 1)});
81+
println!("count(outer, 0): $outer repeats {} times", ${count($outer)});
82+
println!("count(inner, 0): The $inner repetition repeats {} times in the outer repetition", ${count($inner, 0)});
83+
println!("count(inner, 1): $inner repeats {} times in the inner repetitions", ${count($inner, 1)});
8484
};
8585
}
8686
@@ -145,8 +145,8 @@ macro_rules! lets_count {
145145
$(
146146
println!(
147147
"'{}' in inner iteration {}/{} with '{}' in outer iteration {}/{} ",
148-
stringify!($inner), ${index()}, ${length()},
149-
stringify!($outer), ${index(1)}, ${length(1)},
148+
stringify!($inner), ${index()}, ${len()},
149+
stringify!($outer), ${index(1)}, ${len(1)},
150150
);
151151
)*
152152
)*
@@ -178,7 +178,7 @@ macro_rules! repetition_tuples {
178178
(
179179
${index()},
180180
${index(1)}
181-
${ignore(inner)} // without this metavariable expression, compilation would fail
181+
${ignore($inner)} // without this metavariable expression, compilation would fail
182182
),
183183
)*
184184
)*)

0 commit comments

Comments
 (0)
Please sign in to comment.