diff options
| author | bors <bors@rust-lang.org> | 2013-08-18 02:51:59 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-18 02:51:59 -0700 |
| commit | 600901152c223faad80d7cb419cecccd71803723 (patch) | |
| tree | 1fc5d3aa0ee19371cf4ad9aac407a38ff213ac3c /src/libsyntax/parse | |
| parent | 758c5e823621d1a6ef57f7a3a3cd5ba19116a777 (diff) | |
| parent | fdaae344785f11ff4226c6eaaacd7b8c954ca013 (diff) | |
| download | rust-600901152c223faad80d7cb419cecccd71803723.tar.gz rust-600901152c223faad80d7cb419cecccd71803723.zip | |
auto merge of #8550 : kballard/rust/token-start-err-msg, r=catamorphism
The span was fixed at some point to point to the correct character, but the error message is still bad. Update it to emit the actual character in question (potentially escaped). Fixes #3747.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index d0041021f7c..c7b247f2dd2 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -782,7 +782,9 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token { c => { // So the error span points to the unrecognized character rdr.peek_span = codemap::mk_sp(rdr.last_pos, rdr.pos); - rdr.fatal(fmt!("unknown start of token: %d", c as int)); + let mut cs = ~""; + char::escape_default(c, |c| cs.push_char(c)); + rdr.fatal(fmt!("unknown start of token: %s", cs)); } } } |
