@@ -16,7 +16,8 @@ use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Styl
1616use crate :: styled_buffer:: StyledBuffer ;
1717use crate :: {
1818 CodeSuggestion , Diagnostic , DiagnosticArg , DiagnosticId , DiagnosticMessage , FluentBundle ,
19- Handler , Level , MultiSpan , SubDiagnostic , SubstitutionHighlight , SuggestionStyle ,
19+ Handler , LazyFallbackBundle , Level , MultiSpan , SubDiagnostic , SubstitutionHighlight ,
20+ SuggestionStyle ,
2021} ;
2122
2223use rustc_lint_defs:: pluralize;
@@ -60,7 +61,7 @@ impl HumanReadableErrorType {
6061 dst : Box < dyn Write + Send > ,
6162 source_map : Option < Lrc < SourceMap > > ,
6263 bundle : Option < Lrc < FluentBundle > > ,
63- fallback_bundle : Lrc < FluentBundle > ,
64+ fallback_bundle : LazyFallbackBundle ,
6465 teach : bool ,
6566 terminal_width : Option < usize > ,
6667 macro_backtrace : bool ,
@@ -233,7 +234,7 @@ pub trait Emitter {
233234 /// Return `FluentBundle` with localized diagnostics for the default locale of the compiler.
234235 /// Used when the user has not requested a specific language or when a localized diagnostic is
235236 /// unavailable for the requested locale.
236- fn fallback_fluent_bundle ( & self ) -> & Lrc < FluentBundle > ;
237+ fn fallback_fluent_bundle ( & self ) -> & FluentBundle ;
237238
238239 /// Convert diagnostic arguments (a rustc internal type that exists to implement
239240 /// `Encodable`/`Decodable`) into `FluentArgs` which is necessary to perform translation.
@@ -579,8 +580,8 @@ impl Emitter for EmitterWriter {
579580 self . fluent_bundle . as_ref ( )
580581 }
581582
582- fn fallback_fluent_bundle ( & self ) -> & Lrc < FluentBundle > {
583- & self . fallback_bundle
583+ fn fallback_fluent_bundle ( & self ) -> & FluentBundle {
584+ & * * self . fallback_bundle
584585 }
585586
586587 fn emit_diagnostic ( & mut self , diag : & Diagnostic ) {
@@ -635,7 +636,7 @@ impl Emitter for SilentEmitter {
635636 None
636637 }
637638
638- fn fallback_fluent_bundle ( & self ) -> & Lrc < FluentBundle > {
639+ fn fallback_fluent_bundle ( & self ) -> & FluentBundle {
639640 panic ! ( "silent emitter attempted to translate message" )
640641 }
641642
@@ -695,7 +696,7 @@ pub struct EmitterWriter {
695696 dst : Destination ,
696697 sm : Option < Lrc < SourceMap > > ,
697698 fluent_bundle : Option < Lrc < FluentBundle > > ,
698- fallback_bundle : Lrc < FluentBundle > ,
699+ fallback_bundle : LazyFallbackBundle ,
699700 short_message : bool ,
700701 teach : bool ,
701702 ui_testing : bool ,
@@ -716,7 +717,7 @@ impl EmitterWriter {
716717 color_config : ColorConfig ,
717718 source_map : Option < Lrc < SourceMap > > ,
718719 fluent_bundle : Option < Lrc < FluentBundle > > ,
719- fallback_bundle : Lrc < FluentBundle > ,
720+ fallback_bundle : LazyFallbackBundle ,
720721 short_message : bool ,
721722 teach : bool ,
722723 terminal_width : Option < usize > ,
@@ -740,7 +741,7 @@ impl EmitterWriter {
740741 dst : Box < dyn Write + Send > ,
741742 source_map : Option < Lrc < SourceMap > > ,
742743 fluent_bundle : Option < Lrc < FluentBundle > > ,
743- fallback_bundle : Lrc < FluentBundle > ,
744+ fallback_bundle : LazyFallbackBundle ,
744745 short_message : bool ,
745746 teach : bool ,
746747 colored : bool ,
0 commit comments