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.
This commit is contained in:
Russell Cohen 2020-04-02 00:08:58 -04:00
parent 76b11980ad
commit f543689eb6
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`.