diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 002a6caf85c..474e93ed11a 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -772,7 +772,11 @@ fn binop(rdr: @mut StringReader, op: token::binop) -> token::Token { '/' => { return binop(rdr, token::SLASH); } '^' => { return binop(rdr, token::CARET); } '%' => { return binop(rdr, token::PERCENT); } - c => { rdr.fatal(fmt!("unknown start of token: %d", c as int)); } + 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)); + } } }