-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #70681 - rcoh:russell/70677-raw-str-panic, r=petroche…
…nkov Handle unterminated raw strings with no #s properly The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file. Fixes #70677 r? @petrochenkov cc @Centril
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/test/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// This won't actually panic because of the error comment -- the `"` needs to be | ||
// the last byte in the file (including not having a trailing newline) | ||
// Prior to the fix you get the error: 'expected item, found `r" ...`' | ||
// because the string being unterminated wasn't properly detected. | ||
r" //~ unterminated raw string |
9 changes: 9 additions & 0 deletions
9
src/test/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0748]: unterminated raw string | ||
--> $DIR/issue-70677-panic-on-unterminated-raw-str-at-eof.rs:5:1 | ||
| | ||
LL | r" | ||
| ^ unterminated raw string | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0748`. |