11use hir:: GenericParamKind ;
22use rustc_errors:: {
3- fluent, AddSubdiagnostic , Applicability , DiagnosticMessage , DiagnosticStyledString , MultiSpan ,
3+ fluent, AddToDiagnostic , Applicability , DiagnosticMessage , DiagnosticStyledString , MultiSpan ,
44} ;
55use rustc_hir as hir;
66use rustc_hir:: { FnRetTy , Ty } ;
7- use rustc_macros:: SessionDiagnostic ;
7+ use rustc_macros:: { Diagnostic , Subdiagnostic } ;
88use rustc_middle:: ty:: { Region , TyCtxt } ;
99use rustc_span:: symbol:: kw;
1010use rustc_span:: { symbol:: Ident , BytePos , Span } ;
@@ -16,7 +16,7 @@ use crate::infer::error_reporting::{
1616
1717pub mod note_and_explain;
1818
19- #[ derive( SessionDiagnostic ) ]
19+ #[ derive( Diagnostic ) ]
2020#[ diag( infer:: opaque_hidden_type) ]
2121pub struct OpaqueHiddenTypeDiag {
2222 #[ primary_span]
@@ -28,7 +28,7 @@ pub struct OpaqueHiddenTypeDiag {
2828 pub hidden_type : Span ,
2929}
3030
31- #[ derive( SessionDiagnostic ) ]
31+ #[ derive( Diagnostic ) ]
3232#[ diag( infer:: type_annotations_needed, code = "E0282" ) ]
3333pub struct AnnotationRequired < ' a > {
3434 #[ primary_span]
@@ -46,7 +46,7 @@ pub struct AnnotationRequired<'a> {
4646}
4747
4848// Copy of `AnnotationRequired` for E0283
49- #[ derive( SessionDiagnostic ) ]
49+ #[ derive( Diagnostic ) ]
5050#[ diag( infer:: type_annotations_needed, code = "E0283" ) ]
5151pub struct AmbigousImpl < ' a > {
5252 #[ primary_span]
@@ -64,7 +64,7 @@ pub struct AmbigousImpl<'a> {
6464}
6565
6666// Copy of `AnnotationRequired` for E0284
67- #[ derive( SessionDiagnostic ) ]
67+ #[ derive( Diagnostic ) ]
6868#[ diag( infer:: type_annotations_needed, code = "E0284" ) ]
6969pub struct AmbigousReturn < ' a > {
7070 #[ primary_span]
@@ -81,7 +81,7 @@ pub struct AmbigousReturn<'a> {
8181 pub multi_suggestions : Vec < SourceKindMultiSuggestion < ' a > > ,
8282}
8383
84- #[ derive( SessionDiagnostic ) ]
84+ #[ derive( Diagnostic ) ]
8585#[ diag( infer:: need_type_info_in_generator, code = "E0698" ) ]
8686pub struct NeedTypeInfoInGenerator < ' a > {
8787 #[ primary_span]
@@ -92,7 +92,7 @@ pub struct NeedTypeInfoInGenerator<'a> {
9292}
9393
9494// Used when a better one isn't available
95- #[ derive( SessionSubdiagnostic ) ]
95+ #[ derive( Subdiagnostic ) ]
9696#[ label( infer:: label_bad) ]
9797pub struct InferenceBadError < ' a > {
9898 #[ primary_span]
@@ -106,7 +106,7 @@ pub struct InferenceBadError<'a> {
106106 pub name : String ,
107107}
108108
109- #[ derive( SessionSubdiagnostic ) ]
109+ #[ derive( Subdiagnostic ) ]
110110pub enum SourceKindSubdiag < ' a > {
111111 #[ suggestion_verbose(
112112 infer:: source_kind_subdiag_let,
@@ -147,7 +147,7 @@ pub enum SourceKindSubdiag<'a> {
147147 } ,
148148}
149149
150- #[ derive( SessionSubdiagnostic ) ]
150+ #[ derive( Subdiagnostic ) ]
151151pub enum SourceKindMultiSuggestion < ' a > {
152152 #[ multipart_suggestion_verbose(
153153 infer:: source_kind_fully_qualified,
@@ -228,7 +228,7 @@ pub enum RegionOriginNote<'a> {
228228 } ,
229229}
230230
231- impl AddSubdiagnostic for RegionOriginNote < ' _ > {
231+ impl AddToDiagnostic for RegionOriginNote < ' _ > {
232232 fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
233233 let mut label_or_note = |span, msg : DiagnosticMessage | {
234234 let sub_count = diag. children . iter ( ) . filter ( |d| d. span . is_dummy ( ) ) . count ( ) ;
@@ -289,7 +289,7 @@ pub enum LifetimeMismatchLabels {
289289 } ,
290290}
291291
292- impl AddSubdiagnostic for LifetimeMismatchLabels {
292+ impl AddToDiagnostic for LifetimeMismatchLabels {
293293 fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
294294 match self {
295295 LifetimeMismatchLabels :: InRet { param_span, ret_span, span, label_var1 } => {
@@ -339,7 +339,7 @@ pub struct AddLifetimeParamsSuggestion<'a> {
339339 pub add_note : bool ,
340340}
341341
342- impl AddSubdiagnostic for AddLifetimeParamsSuggestion < ' _ > {
342+ impl AddToDiagnostic for AddLifetimeParamsSuggestion < ' _ > {
343343 fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
344344 let mut mk_suggestion = || {
345345 let (
@@ -422,7 +422,7 @@ impl AddSubdiagnostic for AddLifetimeParamsSuggestion<'_> {
422422 }
423423}
424424
425- #[ derive( SessionDiagnostic ) ]
425+ #[ derive( Diagnostic ) ]
426426#[ diag( infer:: lifetime_mismatch, code = "E0623" ) ]
427427pub struct LifetimeMismatch < ' a > {
428428 #[ primary_span]
@@ -438,7 +438,7 @@ pub struct IntroducesStaticBecauseUnmetLifetimeReq {
438438 pub binding_span : Span ,
439439}
440440
441- impl AddSubdiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
441+ impl AddToDiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
442442 fn add_to_diagnostic ( mut self , diag : & mut rustc_errors:: Diagnostic ) {
443443 self . unmet_requirements
444444 . push_span_label ( self . binding_span , fluent:: infer:: msl_introduces_static) ;
@@ -450,7 +450,7 @@ pub struct ImplNote {
450450 pub impl_span : Option < Span > ,
451451}
452452
453- impl AddSubdiagnostic for ImplNote {
453+ impl AddToDiagnostic for ImplNote {
454454 fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
455455 match self . impl_span {
456456 Some ( span) => diag. span_note ( span, fluent:: infer:: msl_impl_note) ,
@@ -465,7 +465,7 @@ pub enum TraitSubdiag {
465465}
466466
467467// FIXME(#100717) used in `Vec<TraitSubdiag>` so requires eager translation/list support
468- impl AddSubdiagnostic for TraitSubdiag {
468+ impl AddToDiagnostic for TraitSubdiag {
469469 fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
470470 match self {
471471 TraitSubdiag :: Note { span } => {
@@ -483,7 +483,7 @@ impl AddSubdiagnostic for TraitSubdiag {
483483 }
484484}
485485
486- #[ derive( SessionDiagnostic ) ]
486+ #[ derive( Diagnostic ) ]
487487#[ diag( infer:: mismatched_static_lifetime) ]
488488pub struct MismatchedStaticLifetime < ' a > {
489489 #[ primary_span]
0 commit comments