diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 21:14:02 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-24 07:59:21 +1100 |
| commit | d51db05d7ee1a12ee168f2d1ccc93ccc11b216c7 (patch) | |
| tree | 6a1bd10bfc900bacf504f9b5e5b7b64378d00e04 /compiler/rustc_parse/src/parser/generics.rs | |
| parent | ec9af0d6cb6386c7be6056a71366d275d5ca3e1e (diff) | |
| download | rust-d51db05d7ee1a12ee168f2d1ccc93ccc11b216c7.tar.gz rust-d51db05d7ee1a12ee168f2d1ccc93ccc11b216c7.zip | |
Remove `ParseSess` methods that duplicate `DiagCtxt` methods.
Also add missing `#[track_caller]` attributes to `DiagCtxt` methods as necessary to keep tests working.
Diffstat (limited to 'compiler/rustc_parse/src/parser/generics.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 6a3b4c1bcb0..7e243c1c32a 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -176,7 +176,7 @@ impl<'a> Parser<'a> { if this.eat_keyword_noexpect(kw::SelfUpper) { // `Self` as a generic param is invalid. Here we emit the diagnostic and continue parsing // as if `Self` never existed. - this.sess.emit_err(UnexpectedSelfInGenericParameters { + this.dcx().emit_err(UnexpectedSelfInGenericParameters { span: this.prev_token.span, }); @@ -200,7 +200,7 @@ impl<'a> Parser<'a> { this.bump(); // `=` this.bump(); // `'lifetime` let span = lo.to(this.prev_token.span); - this.sess.emit_err( + this.dcx().emit_err( UnexpectedDefaultValueForLifetimeInGenericParameters { span }, ); } @@ -225,7 +225,7 @@ impl<'a> Parser<'a> { let snapshot = this.create_snapshot_for_diagnostic(); match this.parse_ty_where_predicate() { Ok(where_predicate) => { - this.sess.emit_err(errors::BadAssocTypeBounds { + this.dcx().emit_err(errors::BadAssocTypeBounds { span: where_predicate.span(), }); // FIXME - try to continue parsing other generics? @@ -242,10 +242,10 @@ impl<'a> Parser<'a> { // Check for trailing attributes and stop parsing. if !attrs.is_empty() { if !params.is_empty() { - this.sess + this.dcx() .emit_err(errors::AttrAfterGeneric { span: attrs[0].span }); } else { - this.sess + this.dcx() .emit_err(errors::AttrWithoutGenerics { span: attrs[0].span }); } } @@ -334,7 +334,7 @@ impl<'a> Parser<'a> { // change we parse those generics now, but report an error. if self.choose_generics_over_qpath(0) { let generics = self.parse_generics()?; - self.sess.emit_err(errors::WhereOnGenerics { span: generics.span }); + self.dcx().emit_err(errors::WhereOnGenerics { span: generics.span }); } loop { @@ -370,7 +370,7 @@ impl<'a> Parser<'a> { let ate_comma = self.eat(&token::Comma); if self.eat_keyword_noexpect(kw::Where) { - self.sess.emit_err(MultipleWhereClauses { + self.dcx().emit_err(MultipleWhereClauses { span: self.token.span, previous: pred_lo, between: prev_token.shrink_to_hi().to(self.prev_token.span), @@ -422,7 +422,7 @@ impl<'a> Parser<'a> { let body_sp = pred_lo.to(snapshot.prev_token.span); let map = self.sess.source_map(); - self.sess.emit_err(WhereClauseBeforeTupleStructBody { + self.dcx().emit_err(WhereClauseBeforeTupleStructBody { span: where_sp, name: struct_name.span, body: body_sp, |
