Skip to content

Commit a4421cc

Browse files
jdmbrson
authored andcommitted
Fix assertion failure when syntax extension name is missing.
1 parent 7c8ee71 commit a4421cc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/comp/front/parser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,9 @@ fn parse_syntax_ext(&parser p) -> @ast::expr {
955955

956956
fn parse_syntax_ext_naked(&parser p, uint lo) -> @ast::expr {
957957
auto pth = parse_path(p);
958+
if (vec::len(pth.node.idents) == 0u) {
959+
p.fatal("expected a syntax expander name");
960+
}
958961
auto es = parse_seq(token::LPAREN, token::RPAREN,
959962
some(token::COMMA), parse_expr, p);
960963
auto hi = es.span.hi;

src/test/compile-fail/ext-noname.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// error-pattern:expected a syntax expander name
2+
3+
fn main() {
4+
#();
5+
}

0 commit comments

Comments
 (0)