rust/tests/source/macro_rules.rs
2018-02-04 11:54:03 +00:00

51 lines
651 B
Rust

macro_rules! m {
// a
($expr :expr, $( $func : ident ) * ) => {
{
let x = $expr;
$func (
x
)
}
};
/* b */
() => {/* c */};
(@tag) =>
{
};
// d
( $item:ident ) => {
mod macro_item { struct $item ; }
};
}
macro m2 {
// a
($expr :expr, $( $func : ident ) * ) => {
{
let x = $expr;
$func (
x
)
}
}
/* b */
() => {/* c */}
(@tag) =>
{
}
// d
( $item:ident ) => {
mod macro_item { struct $item ; }
}
}