rust/tests/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
586 B
Rust
Raw Normal View History

// 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");
}