Fail nicer when the parser doesn't find an expected string literal
Closes #1028
This commit is contained in:
parent
15d33f7957
commit
880b1ec9f5
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
3
src/test/compile-fail/mod-name-non-str.rc
Normal file
3
src/test/compile-fail/mod-name-non-str.rc
Normal file
@ -0,0 +1,3 @@
|
||||
// error-pattern: expected string literal
|
||||
// Issue #1028
|
||||
mod ncurses = x;
|
Loading…
x
Reference in New Issue
Block a user