rust/tests/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs
2024-02-16 20:02:50 +00:00

29 lines
587 B
Rust

//@ run-pass
#![feature(macro_metavar_expr)]
macro_rules! nested {
( $a:ident ) => {
macro_rules! $a {
( $$( $b:ident ),* ) => {
$$(
macro_rules! $b {
( $$$$( $c:ident ),* ) => {
$$$$(
fn $c() -> &'static str { stringify!($c) }
),*
};
}
)*
};
}
};
}
fn main() {
nested!(a);
a!(b);
b!(c);
assert_eq!(c(), "c");
}