Remove Parser
methods that duplicate DiagCtxt
methods.
This commit is contained in:
parent
d86a48278f
commit
ec9af0d6cb
11 changed files with 54 additions and 61 deletions
|
@ -614,7 +614,7 @@ impl<'a> Parser<'a> {
|
|||
// FIXME(compiler-errors): this could be improved by suggesting lifting
|
||||
// this up to the trait, at least before this becomes real syntax.
|
||||
// e.g. `Trait<for<'a> Assoc = Ty>` -> `for<'a> Trait<Assoc = Ty>`
|
||||
return Err(self.struct_span_err(
|
||||
return Err(self.dcx().struct_span_err(
|
||||
arg_span,
|
||||
"`for<...>` is not allowed on associated type bounds",
|
||||
));
|
||||
|
@ -685,6 +685,7 @@ impl<'a> Parser<'a> {
|
|||
let after_eq = eq.shrink_to_hi();
|
||||
let before_next = self.token.span.shrink_to_lo();
|
||||
let mut err = self
|
||||
.dcx()
|
||||
.struct_span_err(after_eq.to(before_next), "missing type to the right of `=`");
|
||||
if matches!(self.token.kind, token::Comma | token::Gt) {
|
||||
err.span_suggestion(
|
||||
|
@ -783,10 +784,13 @@ impl<'a> Parser<'a> {
|
|||
&& let Some(expr) =
|
||||
self.recover_unbraced_const_arg_that_can_begin_ty(snapshot)
|
||||
{
|
||||
return Ok(Some(self.dummy_const_arg_needs_braces(
|
||||
self.struct_span_err(expr.span, "invalid const generic expression"),
|
||||
expr.span,
|
||||
)));
|
||||
return Ok(Some(
|
||||
self.dummy_const_arg_needs_braces(
|
||||
self.dcx()
|
||||
.struct_span_err(expr.span, "invalid const generic expression"),
|
||||
expr.span,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
GenericArg::Type(ty)
|
||||
|
@ -811,7 +815,7 @@ impl<'a> Parser<'a> {
|
|||
match self.parse_expr_res(Restrictions::CONST_EXPR, None) {
|
||||
Ok(expr) => {
|
||||
return Ok(Some(self.dummy_const_arg_needs_braces(
|
||||
self.struct_span_err(expr.span, "invalid const generic expression"),
|
||||
self.dcx().struct_span_err(expr.span, "invalid const generic expression"),
|
||||
expr.span,
|
||||
)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue