Skip to content

Commit 6741dc3

Browse files
committed
---
yaml --- r: 52474 b: refs/heads/dist-snap c: 154488d h: refs/heads/master v: v3
1 parent 4387e0b commit 6741dc3

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 54b2cad8b341434c7c0edb153a0fa662fb2981f1
10+
refs/heads/dist-snap: 154488df1999e4c42f96ebaa6ee6c08be3f999a6
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libsyntax/ext/expand.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ fn core_macros() -> ~str {
300300
)
301301
)
302302

303+
macro_rules! fail_unless(
304+
($cond:expr) => {
305+
if !$cond {
306+
die!(~\"assertion failed: \" + stringify!($cond))
307+
}
308+
}
309+
)
310+
303311
macro_rules! condition (
304312

305313
{ $c:ident: $in:ty -> $out:ty; } => {

branches/dist-snap/src/libsyntax/parse/token.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,24 @@ fn to_str(in: @ident_interner, t: Token) -> ~str {
200200
DOC_COMMENT(s) => *in.get(s),
201201
EOF => ~"<eof>",
202202
INTERPOLATED(ref nt) => {
203-
~"an interpolated " +
204-
match (*nt) {
205-
nt_item(*) => ~"item",
206-
nt_block(*) => ~"block",
207-
nt_stmt(*) => ~"statement",
208-
nt_pat(*) => ~"pattern",
209-
nt_expr(*) => ~"expression",
210-
nt_ty(*) => ~"type",
211-
nt_ident(*) => ~"identifier",
212-
nt_path(*) => ~"path",
213-
nt_tt(*) => ~"tt",
214-
nt_matchers(*) => ~"matcher sequence"
203+
match nt {
204+
&nt_expr(e) => ::print::pprust::expr_to_str(e, in),
205+
_ => {
206+
~"an interpolated " +
207+
match (*nt) {
208+
nt_item(*) => ~"item",
209+
nt_block(*) => ~"block",
210+
nt_stmt(*) => ~"statement",
211+
nt_pat(*) => ~"pattern",
212+
nt_expr(*) => fail ~"should have been handled above",
213+
nt_ty(*) => ~"type",
214+
nt_ident(*) => ~"identifier",
215+
nt_path(*) => ~"path",
216+
nt_tt(*) => ~"tt",
217+
nt_matchers(*) => ~"matcher sequence"
218+
}
215219
}
220+
}
216221
}
217222
}
218223
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// error-pattern:assertion failed: 1 == 2
2+
3+
fn main() {
4+
fail_unless!(1 == 2);
5+
}
6+

0 commit comments

Comments
 (0)