Inline and remove StringReader::struct_fatal_span_char
.
It has a single call site.
This commit is contained in:
parent
4d35981703
commit
8e6bca63f9
1 changed files with 11 additions and 22 deletions
|
@ -7,9 +7,7 @@ use rustc_ast::ast::{self, AttrStyle};
|
||||||
use rustc_ast::token::{self, CommentKind, Delimiter, Token, TokenKind};
|
use rustc_ast::token::{self, CommentKind, Delimiter, Token, TokenKind};
|
||||||
use rustc_ast::tokenstream::TokenStream;
|
use rustc_ast::tokenstream::TokenStream;
|
||||||
use rustc_ast::util::unicode::contains_text_flow_control_chars;
|
use rustc_ast::util::unicode::contains_text_flow_control_chars;
|
||||||
use rustc_errors::{
|
use rustc_errors::{error_code, Applicability, DiagCtxt, Diagnostic, StashKey};
|
||||||
error_code, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder, FatalAbort, StashKey,
|
|
||||||
};
|
|
||||||
use rustc_lexer::unescape::{self, EscapeError, Mode};
|
use rustc_lexer::unescape::{self, EscapeError, Mode};
|
||||||
use rustc_lexer::{Base, DocStyle, RawStrError};
|
use rustc_lexer::{Base, DocStyle, RawStrError};
|
||||||
use rustc_lexer::{Cursor, LiteralKind};
|
use rustc_lexer::{Cursor, LiteralKind};
|
||||||
|
@ -344,18 +342,6 @@ impl<'a> StringReader<'a> {
|
||||||
token::Ident(sym, false)
|
token::Ident(sym, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn struct_fatal_span_char(
|
|
||||||
&self,
|
|
||||||
from_pos: BytePos,
|
|
||||||
to_pos: BytePos,
|
|
||||||
m: &str,
|
|
||||||
c: char,
|
|
||||||
) -> DiagnosticBuilder<'a, FatalAbort> {
|
|
||||||
self.sess
|
|
||||||
.dcx
|
|
||||||
.struct_span_fatal(self.mk_sp(from_pos, to_pos), format!("{}: {}", m, escaped_char(c)))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Detect usages of Unicode codepoints changing the direction of the text on screen and loudly
|
/// Detect usages of Unicode codepoints changing the direction of the text on screen and loudly
|
||||||
/// complain about it.
|
/// complain about it.
|
||||||
fn lint_unicode_text_flow(&self, start: BytePos) {
|
fn lint_unicode_text_flow(&self, start: BytePos) {
|
||||||
|
@ -568,13 +554,16 @@ impl<'a> StringReader<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_non_started_raw_string(&self, start: BytePos, bad_char: char) -> ! {
|
fn report_non_started_raw_string(&self, start: BytePos, bad_char: char) -> ! {
|
||||||
self.struct_fatal_span_char(
|
self.sess
|
||||||
start,
|
.dcx
|
||||||
self.pos,
|
.struct_span_fatal(
|
||||||
"found invalid character; only `#` is allowed in raw string delimitation",
|
self.mk_sp(start, self.pos),
|
||||||
bad_char,
|
format!(
|
||||||
)
|
"found invalid character; only `#` is allowed in raw string delimitation: {}",
|
||||||
.emit()
|
escaped_char(bad_char)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_unterminated_raw_string(
|
fn report_unterminated_raw_string(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue