Rollup merge of #62917 - estebank:trailing-slash, r=matklad

Always emit trailing slash error

Fix #62913.

r? @petrochenkov
This commit is contained in:
Mazdak Farrokhzad 2019-07-24 16:13:20 +02:00 committed by GitHub
commit c44e29bb59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -190,7 +190,7 @@ pub(crate) fn emit_unescape_error(
handler.span_err(span, "empty character literal")
}
EscapeError::LoneSlash => {
panic!("lexer accepted unterminated literal with trailing slash")
handler.span_err(span, "invalid trailing slash in literal")
}
}
}

View File

@ -0,0 +1,3 @@
"\u\\"
//~^ ERROR incorrect unicode escape sequence
//~| ERROR invalid trailing slash in literal

View File

@ -0,0 +1,16 @@
error: incorrect unicode escape sequence
--> $DIR/issue-62913.rs:1:2
|
LL | "\u\"
| ^^^ incorrect unicode escape sequence
|
= help: format of unicode escape sequences is `\u{...}`
error: invalid trailing slash in literal
--> $DIR/issue-62913.rs:1:5
|
LL | "\u\"
| ^
error: aborting due to 2 previous errors