mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Rename Parser::span_fatal_err
-> Parser::span_err
The name was misleading, it wasn't actually a fatal error.
This commit is contained in:
parent
d6d028369b
commit
955fdaea4a
@ -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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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(),
|
||||||
})
|
})
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user