diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 724fcd75386..1e33e223d82 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -653,6 +653,11 @@ fn parse_lit(&parser p) -> ast::lit { p.bump(); lit = ast::lit_str(p.get_str(s), ast::sk_rc); } + case (token::LPAREN) { + p.bump(); + expect(p, token::RPAREN); + lit = ast::lit_nil; + } case (?t) { unexpected(p, t); } } } diff --git a/src/test/run-pass/nil-pattern.rs b/src/test/run-pass/nil-pattern.rs new file mode 100644 index 00000000000..63f0787950e --- /dev/null +++ b/src/test/run-pass/nil-pattern.rs @@ -0,0 +1,8 @@ +// xfail-stage0 +fn main() { + auto x = (); + alt (x) { + case (()) { + } + } +}