Rename Parser::span_fatal_err -> Parser::span_err

The name was misleading, it wasn't actually a fatal error.
This commit is contained in:
Joshua Nelson 2021-03-27 22:46:50 -04:00
parent d6d028369b
commit 955fdaea4a
4 changed files with 4 additions and 8 deletions

View File

@ -144,11 +144,7 @@ impl AttemptLocalParseRecovery {
} }
impl<'a> Parser<'a> { impl<'a> Parser<'a> {
pub(super) fn span_fatal_err<S: Into<MultiSpan>>( pub(super) fn span_err<S: Into<MultiSpan>>(&self, sp: S, err: Error) -> DiagnosticBuilder<'a> {
&self,
sp: S,
err: Error,
) -> DiagnosticBuilder<'a> {
err.span_err(sp, self.diagnostic()) err.span_err(sp, self.diagnostic())
} }

View File

@ -1326,7 +1326,7 @@ impl<'a> Parser<'a> {
token::CloseDelim(token::Brace) => {} token::CloseDelim(token::Brace) => {}
token::DocComment(..) => { token::DocComment(..) => {
let previous_span = self.prev_token.span; let previous_span = self.prev_token.span;
let mut err = self.span_fatal_err(self.token.span, Error::UselessDocComment); let mut err = self.span_err(self.token.span, Error::UselessDocComment);
self.bump(); // consume the doc comment self.bump(); // consume the doc comment
let comma_after_doc_seen = self.eat(&token::Comma); let comma_after_doc_seen = self.eat(&token::Comma);
// `seen_comma` is always false, because we are inside doc block // `seen_comma` is always false, because we are inside doc block

View File

@ -525,7 +525,7 @@ impl<'a> Parser<'a> {
fn ident_or_err(&mut self) -> PResult<'a, (Ident, /* is_raw */ bool)> { fn ident_or_err(&mut self) -> PResult<'a, (Ident, /* is_raw */ bool)> {
self.token.ident().ok_or_else(|| match self.prev_token.kind { self.token.ident().ok_or_else(|| match self.prev_token.kind {
TokenKind::DocComment(..) => { TokenKind::DocComment(..) => {
self.span_fatal_err(self.prev_token.span, Error::UselessDocComment) self.span_err(self.prev_token.span, Error::UselessDocComment)
} }
_ => self.expected_ident_found(), _ => self.expected_ident_found(),
}) })

View File

@ -168,7 +168,7 @@ impl<'a> Parser<'a> {
fn error_outer_attrs(&self, attrs: &[Attribute]) { fn error_outer_attrs(&self, attrs: &[Attribute]) {
if let [.., last] = attrs { if let [.., last] = attrs {
if last.is_doc_comment() { if last.is_doc_comment() {
self.span_fatal_err(last.span, Error::UselessDocComment).emit(); self.span_err(last.span, Error::UselessDocComment).emit();
} else if attrs.iter().any(|a| a.style == AttrStyle::Outer) { } else if attrs.iter().any(|a| a.style == AttrStyle::Outer) {
self.struct_span_err(last.span, "expected statement after outer attribute").emit(); self.struct_span_err(last.span, "expected statement after outer attribute").emit();
} }