1
1
use hir:: GenericParamKind ;
2
2
use rustc_errors:: {
3
- fluent, AddSubdiagnostic , Applicability , DiagnosticMessage , DiagnosticStyledString , MultiSpan ,
3
+ fluent, AddToDiagnostic , Applicability , DiagnosticMessage , DiagnosticStyledString , MultiSpan ,
4
4
} ;
5
5
use rustc_hir as hir;
6
6
use rustc_hir:: { FnRetTy , Ty } ;
7
- use rustc_macros:: SessionDiagnostic ;
7
+ use rustc_macros:: { Diagnostic , Subdiagnostic } ;
8
8
use rustc_middle:: ty:: { Region , TyCtxt } ;
9
9
use rustc_span:: symbol:: kw;
10
10
use rustc_span:: { symbol:: Ident , BytePos , Span } ;
@@ -16,7 +16,7 @@ use crate::infer::error_reporting::{
16
16
17
17
pub mod note_and_explain;
18
18
19
- #[ derive( SessionDiagnostic ) ]
19
+ #[ derive( Diagnostic ) ]
20
20
#[ diag( infer:: opaque_hidden_type) ]
21
21
pub struct OpaqueHiddenTypeDiag {
22
22
#[ primary_span]
@@ -28,7 +28,7 @@ pub struct OpaqueHiddenTypeDiag {
28
28
pub hidden_type : Span ,
29
29
}
30
30
31
- #[ derive( SessionDiagnostic ) ]
31
+ #[ derive( Diagnostic ) ]
32
32
#[ diag( infer:: type_annotations_needed, code = "E0282" ) ]
33
33
pub struct AnnotationRequired < ' a > {
34
34
#[ primary_span]
@@ -46,7 +46,7 @@ pub struct AnnotationRequired<'a> {
46
46
}
47
47
48
48
// Copy of `AnnotationRequired` for E0283
49
- #[ derive( SessionDiagnostic ) ]
49
+ #[ derive( Diagnostic ) ]
50
50
#[ diag( infer:: type_annotations_needed, code = "E0283" ) ]
51
51
pub struct AmbigousImpl < ' a > {
52
52
#[ primary_span]
@@ -64,7 +64,7 @@ pub struct AmbigousImpl<'a> {
64
64
}
65
65
66
66
// Copy of `AnnotationRequired` for E0284
67
- #[ derive( SessionDiagnostic ) ]
67
+ #[ derive( Diagnostic ) ]
68
68
#[ diag( infer:: type_annotations_needed, code = "E0284" ) ]
69
69
pub struct AmbigousReturn < ' a > {
70
70
#[ primary_span]
@@ -81,7 +81,7 @@ pub struct AmbigousReturn<'a> {
81
81
pub multi_suggestions : Vec < SourceKindMultiSuggestion < ' a > > ,
82
82
}
83
83
84
- #[ derive( SessionDiagnostic ) ]
84
+ #[ derive( Diagnostic ) ]
85
85
#[ diag( infer:: need_type_info_in_generator, code = "E0698" ) ]
86
86
pub struct NeedTypeInfoInGenerator < ' a > {
87
87
#[ primary_span]
@@ -92,7 +92,7 @@ pub struct NeedTypeInfoInGenerator<'a> {
92
92
}
93
93
94
94
// Used when a better one isn't available
95
- #[ derive( SessionSubdiagnostic ) ]
95
+ #[ derive( Subdiagnostic ) ]
96
96
#[ label( infer:: label_bad) ]
97
97
pub struct InferenceBadError < ' a > {
98
98
#[ primary_span]
@@ -106,7 +106,7 @@ pub struct InferenceBadError<'a> {
106
106
pub name : String ,
107
107
}
108
108
109
- #[ derive( SessionSubdiagnostic ) ]
109
+ #[ derive( Subdiagnostic ) ]
110
110
pub enum SourceKindSubdiag < ' a > {
111
111
#[ suggestion_verbose(
112
112
infer:: source_kind_subdiag_let,
@@ -147,7 +147,7 @@ pub enum SourceKindSubdiag<'a> {
147
147
} ,
148
148
}
149
149
150
- #[ derive( SessionSubdiagnostic ) ]
150
+ #[ derive( Subdiagnostic ) ]
151
151
pub enum SourceKindMultiSuggestion < ' a > {
152
152
#[ multipart_suggestion_verbose(
153
153
infer:: source_kind_fully_qualified,
@@ -228,7 +228,7 @@ pub enum RegionOriginNote<'a> {
228
228
} ,
229
229
}
230
230
231
- impl AddSubdiagnostic for RegionOriginNote < ' _ > {
231
+ impl AddToDiagnostic for RegionOriginNote < ' _ > {
232
232
fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
233
233
let mut label_or_note = |span, msg : DiagnosticMessage | {
234
234
let sub_count = diag. children . iter ( ) . filter ( |d| d. span . is_dummy ( ) ) . count ( ) ;
@@ -289,7 +289,7 @@ pub enum LifetimeMismatchLabels {
289
289
} ,
290
290
}
291
291
292
- impl AddSubdiagnostic for LifetimeMismatchLabels {
292
+ impl AddToDiagnostic for LifetimeMismatchLabels {
293
293
fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
294
294
match self {
295
295
LifetimeMismatchLabels :: InRet { param_span, ret_span, span, label_var1 } => {
@@ -339,7 +339,7 @@ pub struct AddLifetimeParamsSuggestion<'a> {
339
339
pub add_note : bool ,
340
340
}
341
341
342
- impl AddSubdiagnostic for AddLifetimeParamsSuggestion < ' _ > {
342
+ impl AddToDiagnostic for AddLifetimeParamsSuggestion < ' _ > {
343
343
fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
344
344
let mut mk_suggestion = || {
345
345
let (
@@ -422,7 +422,7 @@ impl AddSubdiagnostic for AddLifetimeParamsSuggestion<'_> {
422
422
}
423
423
}
424
424
425
- #[ derive( SessionDiagnostic ) ]
425
+ #[ derive( Diagnostic ) ]
426
426
#[ diag( infer:: lifetime_mismatch, code = "E0623" ) ]
427
427
pub struct LifetimeMismatch < ' a > {
428
428
#[ primary_span]
@@ -438,7 +438,7 @@ pub struct IntroducesStaticBecauseUnmetLifetimeReq {
438
438
pub binding_span : Span ,
439
439
}
440
440
441
- impl AddSubdiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
441
+ impl AddToDiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
442
442
fn add_to_diagnostic ( mut self , diag : & mut rustc_errors:: Diagnostic ) {
443
443
self . unmet_requirements
444
444
. push_span_label ( self . binding_span , fluent:: infer:: msl_introduces_static) ;
@@ -450,7 +450,7 @@ pub struct ImplNote {
450
450
pub impl_span : Option < Span > ,
451
451
}
452
452
453
- impl AddSubdiagnostic for ImplNote {
453
+ impl AddToDiagnostic for ImplNote {
454
454
fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
455
455
match self . impl_span {
456
456
Some ( span) => diag. span_note ( span, fluent:: infer:: msl_impl_note) ,
@@ -465,7 +465,7 @@ pub enum TraitSubdiag {
465
465
}
466
466
467
467
// FIXME(#100717) used in `Vec<TraitSubdiag>` so requires eager translation/list support
468
- impl AddSubdiagnostic for TraitSubdiag {
468
+ impl AddToDiagnostic for TraitSubdiag {
469
469
fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
470
470
match self {
471
471
TraitSubdiag :: Note { span } => {
@@ -483,7 +483,7 @@ impl AddSubdiagnostic for TraitSubdiag {
483
483
}
484
484
}
485
485
486
- #[ derive( SessionDiagnostic ) ]
486
+ #[ derive( Diagnostic ) ]
487
487
#[ diag( infer:: mismatched_static_lifetime) ]
488
488
pub struct MismatchedStaticLifetime < ' a > {
489
489
#[ primary_span]
0 commit comments