Skip to content

Commit d57d00c

Browse files
committed
---
yaml --- r: 22445 b: refs/heads/master c: 650009f h: refs/heads/master i: 22443: b63ad41 v: v3
1 parent d71b122 commit d57d00c

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c0abd6a2eba72f0bde46abc33abcf361d45c376c
2+
refs/heads/master: 650009f80cfc20d1c3a8d31ebe6593b65e5951bf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/test/run-pass/macro-2.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
// xfail-pretty - token trees can't pretty print
2+
13
fn main() {
24
#macro[[#mylambda[x, body],
35
{
4-
fn f(x: int) -> int { ret body }
6+
fn f(x: int) -> int { ret body; }
57
f
68
}]];
79

810
assert (#mylambda[y, y * 2](8) == 16);
11+
12+
macro_rules! mylambda_tt{
13+
{$x:ident, $body:expr} => {
14+
fn f($x: int) -> int { ret $body; };
15+
f
16+
}
17+
}
18+
19+
assert(mylambda_tt!{y, y * 2}(8) == 16)
920
}

trunk/src/test/run-pass/macro-3.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
// xfail-pretty - token trees can't pretty print
2+
13
fn main() {
24
#macro[[#trivial[], 1 * 2 * 4 * 2 * 1]];
35

46
assert (#trivial[] == 16);
7+
8+
macro_rules! trivial_tt{
9+
{} => {1*2*4*2*1}
10+
}
11+
assert(trivial_tt!{} == 16);
512
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
// xfail-pretty - token trees can't pretty print
2+
13
fn main() {
24
#macro[[#apply[f, [x, ...]], f(x, ...)]];
35

6+
macro_rules! apply_tt{
7+
{$f:expr, ($($x:expr),*)} => {$f($($x),*)}
8+
}
9+
410
fn add(a: int, b: int) -> int { ret a + b; }
511

612
assert (#apply[add, [1, 15]] == 16);
13+
assert(apply_tt!{add, (1, 15)} == 16);
714
}

trunk/src/test/run-pass/macro.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
fn main() { #macro[[#m1[a], a * 4]]; assert (#m1[2] == 8); }
1+
// xfail-pretty - token trees can't pretty print
2+
3+
fn main() {
4+
#macro[[#m1[a], a * 4]];
5+
assert (#m1[2] == 8);
6+
7+
macro_rules! m1tt {
8+
{$a:expr} => {$a*4}
9+
};
10+
assert(m1tt!{2} == 8);
11+
}

0 commit comments

Comments
 (0)