Remove Parser methods that duplicate DiagCtxt methods.

This commit is contained in:
Nicholas Nethercote 2023-12-18 21:09:22 +11:00
parent d86a48278f
commit ec9af0d6cb
11 changed files with 54 additions and 61 deletions

View file

@ -370,7 +370,7 @@ impl<'a> Parser<'a> {
self.mk_expr(span, aopexpr)
}
AssocOp::As | AssocOp::DotDot | AssocOp::DotDotEq => {
self.span_bug(span, "AssocOp should have been handled by special case")
self.dcx().span_bug(span, "AssocOp should have been handled by special case")
}
};
@ -857,7 +857,7 @@ impl<'a> Parser<'a> {
_ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
}
);
let mut err = self.struct_span_err(span, msg);
let mut err = self.dcx().struct_span_err(span, msg);
let suggest_parens = |err: &mut Diagnostic| {
let suggestions = vec![
@ -1967,7 +1967,7 @@ impl<'a> Parser<'a> {
let token = self.token.clone();
let err = |self_: &Self| {
let msg = format!("unexpected token: {}", super::token_descr(&token));
self_.struct_span_err(token.span, msg)
self_.dcx().struct_span_err(token.span, msg)
};
// On an error path, eagerly consider a lifetime to be an unclosed character lit
if self.token.is_lifetime() {