2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-07-11 12:42:59 -05:00
|
|
|
// xfail-pretty - token trees can't pretty print
|
|
|
|
|
2013-10-02 22:00:54 -05:00
|
|
|
#[feature(macro_rules)];
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2012-07-11 12:42:59 -05:00
|
|
|
|
2012-08-22 19:47:11 -05:00
|
|
|
macro_rules! mylambda_tt(
|
2012-11-21 14:53:49 -06:00
|
|
|
($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
|
2012-11-21 14:53:49 -06:00
|
|
|
})
|
2012-08-22 19:47:11 -05:00
|
|
|
)
|
2012-07-11 12:42:59 -05:00
|
|
|
|
2013-03-28 20:39:09 -05:00
|
|
|
assert!(mylambda_tt!(y, y * 2)(8) == 16)
|
2011-08-19 17:16:48 -05:00
|
|
|
}
|