mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-17 11:05:20 +00:00
21 lines
430 B
Rust
21 lines
430 B
Rust
// xfail-pretty - token trees can't pretty print
|
|
|
|
fn main() {
|
|
#macro[[#mylambda[x, body],
|
|
{
|
|
fn f(x: int) -> int { ret body; }
|
|
f
|
|
}]];
|
|
|
|
assert (#mylambda[y, y * 2](8) == 16);
|
|
|
|
macro_rules! mylambda_tt{
|
|
{$x:ident, $body:expr} => {
|
|
fn f($x: int) -> int { ret $body; };
|
|
f
|
|
}
|
|
}
|
|
|
|
assert(mylambda_tt!{y, y * 2}(8) == 16)
|
|
}
|