diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 21:09:22 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-24 07:48:47 +1100 |
| commit | ec9af0d6cb6386c7be6056a71366d275d5ca3e1e (patch) | |
| tree | bc1f47d1b6ffcd24303a9572161c463408f5e0e5 /compiler/rustc_parse/src/parser/path.rs | |
| parent | d86a48278f7bcd069a56870a70c6376e77bd4ee5 (diff) | |
| download | rust-ec9af0d6cb6386c7be6056a71366d275d5ca3e1e.tar.gz rust-ec9af0d6cb6386c7be6056a71366d275d5ca3e1e.zip | |
Remove `Parser` methods that duplicate `DiagCtxt` methods.
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 405531c1e41..047983836a2 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -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, ))); } |
