@@ -5,7 +5,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
55use rustc_data_structures:: sync:: IntoDynSyncSend ;
66use rustc_errors:: emitter:: { DynEmitter , Emitter , HumanEmitter , SilentEmitter , stderr_destination} ;
77use rustc_errors:: registry:: Registry ;
8- use rustc_errors:: translation:: Translate ;
8+ use rustc_errors:: translation:: Translator ;
99use rustc_errors:: { ColorConfig , Diag , DiagCtxt , DiagInner , Level as DiagnosticLevel } ;
1010use rustc_session:: parse:: ParseSess as RawParseSess ;
1111use rustc_span:: {
@@ -47,16 +47,6 @@ impl SilentOnIgnoredFilesEmitter {
4747 }
4848}
4949
50- impl Translate for SilentOnIgnoredFilesEmitter {
51- fn fluent_bundle ( & self ) -> Option < & rustc_errors:: FluentBundle > {
52- self . emitter . fluent_bundle ( )
53- }
54-
55- fn fallback_fluent_bundle ( & self ) -> & rustc_errors:: FluentBundle {
56- self . emitter . fallback_fluent_bundle ( )
57- }
58- }
59-
6050impl Emitter for SilentOnIgnoredFilesEmitter {
6151 fn source_map ( & self ) -> Option < & SourceMap > {
6252 None
@@ -84,6 +74,10 @@ impl Emitter for SilentOnIgnoredFilesEmitter {
8474 }
8575 self . handle_non_ignoreable_error ( diag, registry) ;
8676 }
77+
78+ fn translator ( & self ) -> & Translator {
79+ self . emitter . translator ( )
80+ }
8781}
8882
8983impl From < Color > for ColorConfig {
@@ -110,12 +104,9 @@ fn default_dcx(
110104 ColorConfig :: Never
111105 } ;
112106
113- let fallback_bundle = rustc_errors:: fallback_fluent_bundle (
114- rustc_driver:: DEFAULT_LOCALE_RESOURCES . to_vec ( ) ,
115- false ,
116- ) ;
107+ let translator = rustc_driver:: default_translator ( ) ;
117108 let emitter = Box :: new (
118- HumanEmitter :: new ( stderr_destination ( emit_color) , fallback_bundle )
109+ HumanEmitter :: new ( stderr_destination ( emit_color) , translator )
119110 . sm ( Some ( source_map. clone ( ) ) ) ,
120111 ) ;
121112
@@ -335,16 +326,6 @@ mod tests {
335326 num_emitted_errors : Arc < AtomicU32 > ,
336327 }
337328
338- impl Translate for TestEmitter {
339- fn fluent_bundle ( & self ) -> Option < & rustc_errors:: FluentBundle > {
340- None
341- }
342-
343- fn fallback_fluent_bundle ( & self ) -> & rustc_errors:: FluentBundle {
344- panic ! ( "test emitter attempted to translate a diagnostic" ) ;
345- }
346- }
347-
348329 impl Emitter for TestEmitter {
349330 fn source_map ( & self ) -> Option < & SourceMap > {
350331 None
@@ -353,6 +334,10 @@ mod tests {
353334 fn emit_diagnostic ( & mut self , _diag : DiagInner , _registry : & Registry ) {
354335 self . num_emitted_errors . fetch_add ( 1 , Ordering :: Release ) ;
355336 }
337+
338+ fn translator ( & self ) -> & Translator {
339+ panic ! ( "test emitter attempted to translate a diagnostic" ) ;
340+ }
356341 }
357342
358343 fn build_diagnostic ( level : DiagnosticLevel , span : Option < MultiSpan > ) -> DiagInner {
0 commit comments