rust/tests/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs
2023-01-11 09:32:08 +00:00

29 lines
586 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");
}