mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +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 {
|
let (lit_kind, mode, prefix_len, postfix_len) = match kind {
|
||||||
rustc_lexer::LiteralKind::Char { terminated } => {
|
rustc_lexer::LiteralKind::Char { terminated } => {
|
||||||
if !terminated {
|
if !terminated {
|
||||||
self.sess
|
self.sess.span_diagnostic.span_fatal_with_code(
|
||||||
.span_diagnostic
|
self.mk_sp(start, suffix_start),
|
||||||
.struct_span_fatal_with_code(
|
"unterminated character literal",
|
||||||
self.mk_sp(start, suffix_start),
|
error_code!(E0762),
|
||||||
"unterminated character literal",
|
)
|
||||||
error_code!(E0762),
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
FatalError.raise();
|
|
||||||
}
|
}
|
||||||
(token::Char, Mode::Char, 1, 1) // ' '
|
(token::Char, Mode::Char, 1, 1) // ' '
|
||||||
}
|
}
|
||||||
rustc_lexer::LiteralKind::Byte { terminated } => {
|
rustc_lexer::LiteralKind::Byte { terminated } => {
|
||||||
if !terminated {
|
if !terminated {
|
||||||
self.sess
|
self.sess.span_diagnostic.span_fatal_with_code(
|
||||||
.span_diagnostic
|
self.mk_sp(start + BytePos(1), suffix_start),
|
||||||
.struct_span_fatal_with_code(
|
"unterminated byte constant",
|
||||||
self.mk_sp(start + BytePos(1), suffix_start),
|
error_code!(E0763),
|
||||||
"unterminated byte constant",
|
)
|
||||||
error_code!(E0763),
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
FatalError.raise();
|
|
||||||
}
|
}
|
||||||
(token::Byte, Mode::Byte, 2, 1) // b' '
|
(token::Byte, Mode::Byte, 2, 1) // b' '
|
||||||
}
|
}
|
||||||
rustc_lexer::LiteralKind::Str { terminated } => {
|
rustc_lexer::LiteralKind::Str { terminated } => {
|
||||||
if !terminated {
|
if !terminated {
|
||||||
self.sess
|
self.sess.span_diagnostic.span_fatal_with_code(
|
||||||
.span_diagnostic
|
self.mk_sp(start, suffix_start),
|
||||||
.struct_span_fatal_with_code(
|
"unterminated double quote string",
|
||||||
self.mk_sp(start, suffix_start),
|
error_code!(E0765),
|
||||||
"unterminated double quote string",
|
)
|
||||||
error_code!(E0765),
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
FatalError.raise();
|
|
||||||
}
|
}
|
||||||
(token::Str, Mode::Str, 1, 1) // " "
|
(token::Str, Mode::Str, 1, 1) // " "
|
||||||
}
|
}
|
||||||
rustc_lexer::LiteralKind::ByteStr { terminated } => {
|
rustc_lexer::LiteralKind::ByteStr { terminated } => {
|
||||||
if !terminated {
|
if !terminated {
|
||||||
self.sess
|
self.sess.span_diagnostic.span_fatal_with_code(
|
||||||
.span_diagnostic
|
self.mk_sp(start + BytePos(1), suffix_start),
|
||||||
.struct_span_fatal_with_code(
|
"unterminated double quote byte string",
|
||||||
self.mk_sp(start + BytePos(1), suffix_start),
|
error_code!(E0766),
|
||||||
"unterminated double quote byte string",
|
)
|
||||||
error_code!(E0766),
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
FatalError.raise();
|
|
||||||
}
|
}
|
||||||
(token::ByteStr, Mode::ByteStr, 2, 1) // b" "
|
(token::ByteStr, Mode::ByteStr, 2, 1) // b" "
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user