Rename Parser::span_diagnostic
as Parser::dcx
.
This commit is contained in:
parent
09af8a667c
commit
73bac456d4
8 changed files with 40 additions and 42 deletions
|
@ -1269,7 +1269,7 @@ impl<'a> Parser<'a> {
|
|||
.collect(),
|
||||
},
|
||||
}
|
||||
.into_diagnostic(self.diagnostic());
|
||||
.into_diagnostic(self.dcx());
|
||||
replacement_err.emit();
|
||||
|
||||
let old_err = mem::replace(err, replacement_err);
|
||||
|
@ -1693,8 +1693,7 @@ impl<'a> Parser<'a> {
|
|||
mk_lit_char: impl FnOnce(Symbol, Span) -> L,
|
||||
err: impl FnOnce(&Self) -> DiagnosticBuilder<'a, ErrorGuaranteed>,
|
||||
) -> L {
|
||||
if let Some(mut diag) =
|
||||
self.diagnostic().steal_diagnostic(lifetime.span, StashKey::LifetimeIsChar)
|
||||
if let Some(mut diag) = self.dcx().steal_diagnostic(lifetime.span, StashKey::LifetimeIsChar)
|
||||
{
|
||||
diag.span_suggestion_verbose(
|
||||
lifetime.span.shrink_to_hi(),
|
||||
|
@ -1884,8 +1883,8 @@ impl<'a> Parser<'a> {
|
|||
self.bump(); // `#`
|
||||
|
||||
let Some((ident, false)) = self.token.ident() else {
|
||||
let err = errors::ExpectedBuiltinIdent { span: self.token.span }
|
||||
.into_diagnostic(self.diagnostic());
|
||||
let err =
|
||||
errors::ExpectedBuiltinIdent { span: self.token.span }.into_diagnostic(self.dcx());
|
||||
return Err(err);
|
||||
};
|
||||
self.sess.gated_spans.gate(sym::builtin_syntax, ident.span);
|
||||
|
@ -1896,7 +1895,7 @@ impl<'a> Parser<'a> {
|
|||
Ok(res)
|
||||
} else {
|
||||
let err = errors::UnknownBuiltinConstruct { span: lo.to(ident.span), name: ident.name }
|
||||
.into_diagnostic(self.diagnostic());
|
||||
.into_diagnostic(self.dcx());
|
||||
return Err(err);
|
||||
};
|
||||
self.expect(&TokenKind::CloseDelim(Delimiter::Parenthesis))?;
|
||||
|
@ -1960,7 +1959,7 @@ impl<'a> Parser<'a> {
|
|||
&& matches!(e.kind, ExprKind::Err)
|
||||
{
|
||||
let mut err = errors::InvalidInterpolatedExpression { span: self.token.span }
|
||||
.into_diagnostic(self.diagnostic());
|
||||
.into_diagnostic(self.dcx());
|
||||
err.downgrade_to_delayed_bug();
|
||||
return Err(err);
|
||||
}
|
||||
|
@ -2172,7 +2171,7 @@ impl<'a> Parser<'a> {
|
|||
return Err(errors::MissingSemicolonBeforeArray {
|
||||
open_delim: open_delim_span,
|
||||
semicolon: prev_span.shrink_to_hi(),
|
||||
}.into_diagnostic(self.diagnostic()));
|
||||
}.into_diagnostic(self.dcx()));
|
||||
}
|
||||
Ok(_) => (),
|
||||
Err(err) => err.cancel(),
|
||||
|
@ -2320,7 +2319,7 @@ impl<'a> Parser<'a> {
|
|||
if self.check_keyword(kw::Async) {
|
||||
let move_async_span = self.token.span.with_lo(self.prev_token.span.data().lo);
|
||||
Err(errors::AsyncMoveOrderIncorrect { span: move_async_span }
|
||||
.into_diagnostic(self.diagnostic()))
|
||||
.into_diagnostic(self.dcx()))
|
||||
} else {
|
||||
Ok(CaptureBy::Value { move_kw: move_kw_span })
|
||||
}
|
||||
|
@ -2510,7 +2509,7 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
if self.prev_token.kind == token::BinOp(token::Or) {
|
||||
// This was part of a closure, the that part of the parser recover.
|
||||
return Err(err.into_diagnostic(self.diagnostic()));
|
||||
return Err(err.into_diagnostic(self.dcx()));
|
||||
} else {
|
||||
Some(self.sess.emit_err(err))
|
||||
}
|
||||
|
@ -3194,8 +3193,7 @@ impl<'a> Parser<'a> {
|
|||
fn parse_try_block(&mut self, span_lo: Span) -> PResult<'a, P<Expr>> {
|
||||
let (attrs, body) = self.parse_inner_attrs_and_block()?;
|
||||
if self.eat_keyword(kw::Catch) {
|
||||
Err(errors::CatchAfterTry { span: self.prev_token.span }
|
||||
.into_diagnostic(self.diagnostic()))
|
||||
Err(errors::CatchAfterTry { span: self.prev_token.span }.into_diagnostic(self.dcx()))
|
||||
} else {
|
||||
let span = span_lo.to(body.span);
|
||||
self.sess.gated_spans.gate(sym::try_blocks, span);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue