Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/libsyntax/parse/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,11 +1081,12 @@ impl<'a> StringReader<'a> {
if !self.curr_is('\'') {
let last_bpos = self.last_pos;
panic!(self.fatal_span_verbose(
// Byte offsetting here is okay because the
// character before position `start` is an
// ascii single quote.
start - BytePos(1), last_bpos,
"unterminated character constant".to_string()));
// Byte offsetting here is okay because the
// character before position `start` is an
// ascii single quote.
start - BytePos(1), last_bpos,

String::from("character literal may only contain one codepoint")));
}
let id = if valid { self.name_from(start) } else { token::intern("0") };
self.bump(); // advance curr past token
Expand Down
4 changes: 2 additions & 2 deletions src/test/parse-fail/lex-bad-char-literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ static s: &'static str =
"\●" //~ ERROR: unknown character escape
;

// THIS MUST BE LAST, since unterminated character constants kill the lexer
// THIS MUST BE LAST, since it kills the lexer

static c: char =
'//~ ERROR: unterminated character constant
'//~ ERROR: character literal may only contain one codepoint
;