1
- use rustc_errors:: { fluent, AddSubdiagnostic , Applicability , DecorateLint , EmissionGuarantee } ;
1
+ use rustc_errors:: { fluent, AddToDiagnostic , Applicability , DecorateLint , EmissionGuarantee } ;
2
2
use rustc_hir:: def_id:: DefId ;
3
- use rustc_macros:: { LintDiagnostic , SessionSubdiagnostic } ;
3
+ use rustc_macros:: { LintDiagnostic , Subdiagnostic } ;
4
4
use rustc_middle:: ty:: { Predicate , Ty , TyCtxt } ;
5
5
use rustc_span:: { symbol:: Ident , Span , Symbol } ;
6
6
@@ -16,7 +16,7 @@ pub struct ArrayIntoIterDiag<'a> {
16
16
pub sub : Option < ArrayIntoIterDiagSub > ,
17
17
}
18
18
19
- #[ derive( SessionSubdiagnostic ) ]
19
+ #[ derive( Subdiagnostic ) ]
20
20
pub enum ArrayIntoIterDiagSub {
21
21
#[ suggestion( remove_into_iter_suggestion, code = "" , applicability = "maybe-incorrect" ) ]
22
22
RemoveIntoIter {
@@ -129,7 +129,7 @@ pub struct NonCamelCaseType<'a> {
129
129
pub sub : NonCamelCaseTypeSub ,
130
130
}
131
131
132
- #[ derive( SessionSubdiagnostic ) ]
132
+ #[ derive( Subdiagnostic ) ]
133
133
pub enum NonCamelCaseTypeSub {
134
134
#[ label( label) ]
135
135
Label {
@@ -162,8 +162,14 @@ pub enum NonSnakeCaseDiagSub {
162
162
SuggestionAndNote { span : Span } ,
163
163
}
164
164
165
- impl AddSubdiagnostic for NonSnakeCaseDiagSub {
166
- fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
165
+ impl AddToDiagnostic for NonSnakeCaseDiagSub {
166
+ fn add_to_diagnostic_with < F > ( self , diag : & mut rustc_errors:: Diagnostic , _: F )
167
+ where
168
+ F : Fn (
169
+ & mut rustc_errors:: Diagnostic ,
170
+ rustc_errors:: SubdiagnosticMessage ,
171
+ ) -> rustc_errors:: SubdiagnosticMessage ,
172
+ {
167
173
match self {
168
174
NonSnakeCaseDiagSub :: Label { span } => {
169
175
diag. span_label ( span, fluent:: label) ;
@@ -209,7 +215,7 @@ pub struct NonUpperCaseGlobal<'a> {
209
215
pub sub : NonUpperCaseGlobalSub ,
210
216
}
211
217
212
- #[ derive( SessionSubdiagnostic ) ]
218
+ #[ derive( Subdiagnostic ) ]
213
219
pub enum NonUpperCaseGlobalSub {
214
220
#[ label( label) ]
215
221
Label {
@@ -307,8 +313,14 @@ pub enum OverflowingBinHexSign {
307
313
Negative ,
308
314
}
309
315
310
- impl AddSubdiagnostic for OverflowingBinHexSign {
311
- fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
316
+ impl AddToDiagnostic for OverflowingBinHexSign {
317
+ fn add_to_diagnostic_with < F > ( self , diag : & mut rustc_errors:: Diagnostic , _: F )
318
+ where
319
+ F : Fn (
320
+ & mut rustc_errors:: Diagnostic ,
321
+ rustc_errors:: SubdiagnosticMessage ,
322
+ ) -> rustc_errors:: SubdiagnosticMessage ,
323
+ {
312
324
match self {
313
325
OverflowingBinHexSign :: Positive => {
314
326
diag. note ( fluent:: positive_note) ;
@@ -321,7 +333,7 @@ impl AddSubdiagnostic for OverflowingBinHexSign {
321
333
}
322
334
}
323
335
324
- #[ derive( SessionSubdiagnostic ) ]
336
+ #[ derive( Subdiagnostic ) ]
325
337
pub enum OverflowingBinHexSub < ' a > {
326
338
#[ suggestion(
327
339
suggestion,
@@ -493,7 +505,7 @@ pub struct PathStatementDrop {
493
505
pub sub : PathStatementDropSub ,
494
506
}
495
507
496
- #[ derive( SessionSubdiagnostic ) ]
508
+ #[ derive( Subdiagnostic ) ]
497
509
pub enum PathStatementDropSub {
498
510
#[ suggestion( suggestion, code = "drop({snippet});" , applicability = "machine-applicable" ) ]
499
511
Suggestion {
0 commit comments