Skip to content

Commit

Permalink
Auto merge of #50296 - cmdd:master, r=nikomatsakis
Browse files Browse the repository at this point in the history
Add error message for using >= 65535 hashes for raw string literal escapes

Fixes #50111.
  • Loading branch information
bors committed Jun 15, 2018
2 parents 5205ae8 + 313d6c5 commit ab0a442
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/libsyntax/parse/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,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 @@ -1680,6 +1687,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 ab0a442

Please sign in to comment.