mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Remove some unnecessary uses of struct_span_fatal
All of them immediately called `emit()` then `raise()`, so they could just call `span_fatal` directly.
This commit is contained in:
parent
955fdaea4a
commit
e49f4471aa
@ -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" "
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user