@@ -13,7 +13,7 @@ extern crate rustc_session;
13
13
extern crate rustc_span;
14
14
15
15
use rustc_errors:: {
16
- AddToDiagnostic , Diagnostic , DiagnosticBuilder , DiagnosticMessage , ErrorGuaranteed , Handler ,
16
+ AddToDiagnostic , DiagCtxt , Diagnostic , DiagnosticBuilder , DiagnosticMessage , ErrorGuaranteed ,
17
17
IntoDiagnostic , SubdiagnosticMessage ,
18
18
} ;
19
19
use rustc_macros:: { Diagnostic , Subdiagnostic } ;
@@ -38,17 +38,17 @@ struct Note {
38
38
pub struct UntranslatableInIntoDiagnostic ;
39
39
40
40
impl < ' a > IntoDiagnostic < ' a , ErrorGuaranteed > for UntranslatableInIntoDiagnostic {
41
- fn into_diagnostic ( self , handler : & ' a Handler ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
42
- handler . struct_err ( "untranslatable diagnostic" )
41
+ fn into_diagnostic ( self , dcx : & ' a DiagCtxt ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
42
+ dcx . struct_err ( "untranslatable diagnostic" )
43
43
//~^ ERROR diagnostics should be created using translatable messages
44
44
}
45
45
}
46
46
47
47
pub struct TranslatableInIntoDiagnostic ;
48
48
49
49
impl < ' a > IntoDiagnostic < ' a , ErrorGuaranteed > for TranslatableInIntoDiagnostic {
50
- fn into_diagnostic ( self , handler : & ' a Handler ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
51
- handler . struct_err ( crate :: fluent_generated:: no_crate_example)
50
+ fn into_diagnostic ( self , dcx : & ' a DiagCtxt ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
51
+ dcx . struct_err ( crate :: fluent_generated:: no_crate_example)
52
52
}
53
53
}
54
54
@@ -75,18 +75,18 @@ impl AddToDiagnostic for TranslatableInAddToDiagnostic {
75
75
}
76
76
}
77
77
78
- pub fn make_diagnostics < ' a > ( handler : & ' a Handler ) {
79
- let _diag = handler . struct_err ( crate :: fluent_generated:: no_crate_example) ;
78
+ pub fn make_diagnostics < ' a > ( dcx : & ' a DiagCtxt ) {
79
+ let _diag = dcx . struct_err ( crate :: fluent_generated:: no_crate_example) ;
80
80
//~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
81
81
82
- let _diag = handler . struct_err ( "untranslatable diagnostic" ) ;
82
+ let _diag = dcx . struct_err ( "untranslatable diagnostic" ) ;
83
83
//~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
84
84
//~^^ ERROR diagnostics should be created using translatable messages
85
85
}
86
86
87
87
// Check that `rustc_lint_diagnostics`-annotated functions aren't themselves linted.
88
88
89
89
#[ rustc_lint_diagnostics]
90
- pub fn skipped_because_of_annotation < ' a > ( handler : & ' a Handler ) {
91
- let _diag = handler . struct_err ( "untranslatable diagnostic" ) ; // okay!
90
+ pub fn skipped_because_of_annotation < ' a > ( dcx : & ' a DiagCtxt ) {
91
+ let _diag = dcx . struct_err ( "untranslatable diagnostic" ) ; // okay!
92
92
}
0 commit comments