Skip to content

Commit 6009011

Browse files
committed
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.
2 parents 758c5e8 + fdaae34 commit 6009011

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libsyntax/parse/lexer.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,9 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token {
782782
c => {
783783
// So the error span points to the unrecognized character
784784
rdr.peek_span = codemap::mk_sp(rdr.last_pos, rdr.pos);
785-
rdr.fatal(fmt!("unknown start of token: %d", c as int));
785+
let mut cs = ~"";
786+
char::escape_default(c, |c| cs.push_char(c));
787+
rdr.fatal(fmt!("unknown start of token: %s", cs));
786788
}
787789
}
788790
}

0 commit comments

Comments
 (0)