@@ -13,7 +13,7 @@ extern crate rustc_session;
1313extern crate rustc_span;
1414
1515use rustc_errors:: {
16- AddToDiagnostic , Diagnostic , DiagnosticBuilder , DiagnosticMessage , ErrorGuaranteed , Handler ,
16+ AddToDiagnostic , DiagCtxt , Diagnostic , DiagnosticBuilder , DiagnosticMessage , ErrorGuaranteed ,
1717 IntoDiagnostic , SubdiagnosticMessage ,
1818} ;
1919use rustc_macros:: { Diagnostic , Subdiagnostic } ;
@@ -38,17 +38,17 @@ struct Note {
3838pub struct UntranslatableInIntoDiagnostic ;
3939
4040impl < ' 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" )
4343 //~^ ERROR diagnostics should be created using translatable messages
4444 }
4545}
4646
4747pub struct TranslatableInIntoDiagnostic ;
4848
4949impl < ' 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)
5252 }
5353}
5454
@@ -75,18 +75,18 @@ impl AddToDiagnostic for TranslatableInAddToDiagnostic {
7575 }
7676}
7777
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) ;
8080 //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
8181
82- let _diag = handler . struct_err ( "untranslatable diagnostic" ) ;
82+ let _diag = dcx . struct_err ( "untranslatable diagnostic" ) ;
8383 //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
8484 //~^^ ERROR diagnostics should be created using translatable messages
8585}
8686
8787// Check that `rustc_lint_diagnostics`-annotated functions aren't themselves linted.
8888
8989#[ 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!
9292}
0 commit comments