Always emit trailing slash error

This commit is contained in:
Esteban Küber 2019-07-23 16:28:20 -07:00
parent 4bc1ce7bdb
commit e26e6749fb
3 changed files with 20 additions and 1 deletions

View File

@ -191,7 +191,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