Skip to content

Commit

Permalink
provide error message when using more than 65535 hash symbols for raw…
Browse files Browse the repository at this point in the history
… strings
  • Loading branch information
David Cao committed Jun 8, 2018
1 parent c40275b commit 313d6c5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/libsyntax/parse/lexer/mod.rs
Expand Up @@ -1452,6 +1452,13 @@ impl<'a> StringReader<'a> {
self.bump();
let mut hash_count: u16 = 0;
while self.ch_is('#') {
if hash_count == 65535 {
let bpos = self.next_pos;
self.fatal_span_(start_bpos,
bpos,
"too many `#` symbols: raw strings may be \
delimited by up to 65535 `#` symbols").raise();
}
self.bump();
hash_count += 1;
}
Expand Down Expand Up @@ -1682,6 +1689,13 @@ impl<'a> StringReader<'a> {
self.bump();
let mut hash_count = 0;
while self.ch_is('#') {
if hash_count == 65535 {
let bpos = self.next_pos;
self.fatal_span_(start_bpos,
bpos,
"too many `#` symbols: raw byte strings may be \
delimited by up to 65535 `#` symbols").raise();
}
self.bump();
hash_count += 1;
}
Expand Down

0 comments on commit 313d6c5

Please sign in to comment.