diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index bd8dfd678a97..d3ff29a5b1a7 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -315,57 +315,41 @@ impl<'a> StringReader<'a> { let (lit_kind, mode, prefix_len, postfix_len) = match kind { rustc_lexer::LiteralKind::Char { terminated } => { if !terminated { - self.sess - .span_diagnostic - .struct_span_fatal_with_code( - self.mk_sp(start, suffix_start), - "unterminated character literal", - error_code!(E0762), - ) - .emit(); - FatalError.raise(); + self.sess.span_diagnostic.span_fatal_with_code( + self.mk_sp(start, suffix_start), + "unterminated character literal", + error_code!(E0762), + ) } (token::Char, Mode::Char, 1, 1) // ' ' } rustc_lexer::LiteralKind::Byte { terminated } => { if !terminated { - self.sess - .span_diagnostic - .struct_span_fatal_with_code( - self.mk_sp(start + BytePos(1), suffix_start), - "unterminated byte constant", - error_code!(E0763), - ) - .emit(); - FatalError.raise(); + self.sess.span_diagnostic.span_fatal_with_code( + self.mk_sp(start + BytePos(1), suffix_start), + "unterminated byte constant", + error_code!(E0763), + ) } (token::Byte, Mode::Byte, 2, 1) // b' ' } rustc_lexer::LiteralKind::Str { terminated } => { if !terminated { - self.sess - .span_diagnostic - .struct_span_fatal_with_code( - self.mk_sp(start, suffix_start), - "unterminated double quote string", - error_code!(E0765), - ) - .emit(); - FatalError.raise(); + self.sess.span_diagnostic.span_fatal_with_code( + self.mk_sp(start, suffix_start), + "unterminated double quote string", + error_code!(E0765), + ) } (token::Str, Mode::Str, 1, 1) // " " } rustc_lexer::LiteralKind::ByteStr { terminated } => { if !terminated { - self.sess - .span_diagnostic - .struct_span_fatal_with_code( - self.mk_sp(start + BytePos(1), suffix_start), - "unterminated double quote byte string", - error_code!(E0766), - ) - .emit(); - FatalError.raise(); + self.sess.span_diagnostic.span_fatal_with_code( + self.mk_sp(start + BytePos(1), suffix_start), + "unterminated double quote byte string", + error_code!(E0766), + ) } (token::ByteStr, Mode::ByteStr, 2, 1) // b" " }