diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-19 18:04:44 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-19 18:04:44 -0700 |
| commit | 880b1ec9f558281facc0757cbe8ab321564cb17b (patch) | |
| tree | b1e5c169e5a689029ba27173128cd4703f5fcf27 /src/comp/syntax/parse | |
| parent | 15d33f7957ff62f8be4e53409c7d131c2c32dfef (diff) | |
| download | rust-880b1ec9f558281facc0757cbe8ab321564cb17b.tar.gz rust-880b1ec9f558281facc0757cbe8ab321564cb17b.zip | |
Fail nicer when the parser doesn't find an expected string literal
Closes #1028
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index f38d0f9cc77..3b53dbc89fc 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -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") + } } } |
