Skip to content

Commit

Permalink
Rollup merge of rust-lang#62917 - estebank:trailing-slash, r=matklad
Browse files Browse the repository at this point in the history
Always emit trailing slash error

Fix rust-lang#62913.

r? @petrochenkov
  • Loading branch information
Centril authored Jul 24, 2019
2 parents 92aff0a + e26e674 commit c44e29b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/unescape_error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/test/ui/parser/issue-62913.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"\u\\"
//~^ ERROR incorrect unicode escape sequence
//~| ERROR invalid trailing slash in literal
16 changes: 16 additions & 0 deletions src/test/ui/parser/issue-62913.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c44e29b

Please sign in to comment.