2012-07-11 12:42:59 -05:00
|
|
|
// xfail-pretty - token trees can't pretty print
|
|
|
|
|
2011-06-27 12:58:05 -05:00
|
|
|
fn main() {
|
2011-08-19 17:16:48 -05:00
|
|
|
#macro[[#mylambda[x, body],
|
|
|
|
{
|
2012-08-01 19:30:05 -05:00
|
|
|
fn f(x: int) -> int { return body; }
|
2011-08-19 17:16:48 -05:00
|
|
|
f
|
|
|
|
}]];
|
2011-07-13 17:44:09 -05:00
|
|
|
|
2012-07-30 18:01:07 -05:00
|
|
|
assert (mylambda!{y, y * 2}(8) == 16);
|
2012-07-11 12:42:59 -05:00
|
|
|
|
|
|
|
macro_rules! mylambda_tt{
|
|
|
|
{$x:ident, $body:expr} => {
|
2012-08-01 19:30:05 -05:00
|
|
|
fn f($x: int) -> int { return $body; };
|
2012-07-11 12:42:59 -05:00
|
|
|
f
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(mylambda_tt!{y, y * 2}(8) == 16)
|
2011-08-19 17:16:48 -05:00
|
|
|
}
|