mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
18 lines
298 B
Rust
18 lines
298 B
Rust
//@ run-pass
|
|
macro_rules! gen {
|
|
($name:ident ( $($dol:tt $var:ident)* ) $($body:tt)*) => {
|
|
macro_rules! $name {
|
|
($($dol $var:ident)*) => {
|
|
$($body)*
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
gen!(m($var) $var);
|
|
|
|
fn main() {
|
|
let x = 1;
|
|
assert_eq!(m!(x), 1);
|
|
}
|