Skip to content

Commit 1fdc75e

Browse files
paulstansifergraydon
authored andcommitted
Parser fix: 'fail' was eating the next token that came after it.
1 parent f7df369 commit 1fdc75e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/comp/front/parser.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,6 @@ fn parse_bottom_expr(parser p) -> @ast::expr {
898898
ex = expand_syntax_ext(p, es.span, pth, es.node,
899899
none[str]);
900900
} else if (eat_word(p, "fail")) {
901-
p.bump();
902901
ex = ast::expr_fail(p.get_ann());
903902
} else if (eat_word(p, "log")) {
904903
auto e = parse_expr(p);

src/test/compile-fail/fail-simple.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// -*- rust -*-
2+
3+
// error-pattern: after expression but found
4+
fn main() {
5+
fail @ ;
6+
}

src/test/run-pass/parse-fail.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// -*- rust -*-
2+
3+
fn dont_call_me() {
4+
fail;
5+
log 1;
6+
}
7+
8+
fn main() {}

0 commit comments

Comments
 (0)