Rollup merge of #70681 - rcoh:russell/70677-raw-str-panic, r=petrochenkov

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
This commit is contained in:
Mazdak Farrokhzad 2020-04-02 14:28:03 +02:00 committed by GitHub
commit ec0da7222d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 1 deletions

View file

@ -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

View file

@ -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`.