Fail nicer when the parser doesn't find an expected string literal

Closes #1028
This commit is contained in:
Brian Anderson 2011-10-19 18:04:44 -07:00
parent 15d33f7957
commit 880b1ec9f5
2 changed files with 7 additions and 2 deletions

View File

@ -2489,8 +2489,10 @@ fn parse_crate_mod(p: parser, _cfg: ast::crate_cfg) -> @ast::crate {
fn parse_str(p: parser) -> str {
alt p.peek() {
token::LIT_STR(s) { p.bump(); ret p.get_str(s); }
_ { fail; }
token::LIT_STR(s) { p.bump(); p.get_str(s) }
_ {
p.fatal("expected string literal")
}
}
}

View File

@ -0,0 +1,3 @@
// error-pattern: expected string literal
// Issue #1028
mod ncurses = x;