@@ -16,7 +16,8 @@ use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Styl
16
16
use crate :: styled_buffer:: StyledBuffer ;
17
17
use crate :: {
18
18
CodeSuggestion , Diagnostic , DiagnosticArg , DiagnosticId , DiagnosticMessage , FluentBundle ,
19
- Handler , Level , MultiSpan , SubDiagnostic , SubstitutionHighlight , SuggestionStyle ,
19
+ Handler , LazyFallbackBundle , Level , MultiSpan , SubDiagnostic , SubstitutionHighlight ,
20
+ SuggestionStyle ,
20
21
} ;
21
22
22
23
use rustc_lint_defs:: pluralize;
@@ -60,7 +61,7 @@ impl HumanReadableErrorType {
60
61
dst : Box < dyn Write + Send > ,
61
62
source_map : Option < Lrc < SourceMap > > ,
62
63
bundle : Option < Lrc < FluentBundle > > ,
63
- fallback_bundle : Lrc < FluentBundle > ,
64
+ fallback_bundle : LazyFallbackBundle ,
64
65
teach : bool ,
65
66
terminal_width : Option < usize > ,
66
67
macro_backtrace : bool ,
@@ -233,7 +234,7 @@ pub trait Emitter {
233
234
/// Return `FluentBundle` with localized diagnostics for the default locale of the compiler.
234
235
/// Used when the user has not requested a specific language or when a localized diagnostic is
235
236
/// unavailable for the requested locale.
236
- fn fallback_fluent_bundle ( & self ) -> & Lrc < FluentBundle > ;
237
+ fn fallback_fluent_bundle ( & self ) -> & FluentBundle ;
237
238
238
239
/// Convert diagnostic arguments (a rustc internal type that exists to implement
239
240
/// `Encodable`/`Decodable`) into `FluentArgs` which is necessary to perform translation.
@@ -579,8 +580,8 @@ impl Emitter for EmitterWriter {
579
580
self . fluent_bundle . as_ref ( )
580
581
}
581
582
582
- fn fallback_fluent_bundle ( & self ) -> & Lrc < FluentBundle > {
583
- & self . fallback_bundle
583
+ fn fallback_fluent_bundle ( & self ) -> & FluentBundle {
584
+ & * * self . fallback_bundle
584
585
}
585
586
586
587
fn emit_diagnostic ( & mut self , diag : & Diagnostic ) {
@@ -635,7 +636,7 @@ impl Emitter for SilentEmitter {
635
636
None
636
637
}
637
638
638
- fn fallback_fluent_bundle ( & self ) -> & Lrc < FluentBundle > {
639
+ fn fallback_fluent_bundle ( & self ) -> & FluentBundle {
639
640
panic ! ( "silent emitter attempted to translate message" )
640
641
}
641
642
@@ -695,7 +696,7 @@ pub struct EmitterWriter {
695
696
dst : Destination ,
696
697
sm : Option < Lrc < SourceMap > > ,
697
698
fluent_bundle : Option < Lrc < FluentBundle > > ,
698
- fallback_bundle : Lrc < FluentBundle > ,
699
+ fallback_bundle : LazyFallbackBundle ,
699
700
short_message : bool ,
700
701
teach : bool ,
701
702
ui_testing : bool ,
@@ -716,7 +717,7 @@ impl EmitterWriter {
716
717
color_config : ColorConfig ,
717
718
source_map : Option < Lrc < SourceMap > > ,
718
719
fluent_bundle : Option < Lrc < FluentBundle > > ,
719
- fallback_bundle : Lrc < FluentBundle > ,
720
+ fallback_bundle : LazyFallbackBundle ,
720
721
short_message : bool ,
721
722
teach : bool ,
722
723
terminal_width : Option < usize > ,
@@ -740,7 +741,7 @@ impl EmitterWriter {
740
741
dst : Box < dyn Write + Send > ,
741
742
source_map : Option < Lrc < SourceMap > > ,
742
743
fluent_bundle : Option < Lrc < FluentBundle > > ,
743
- fallback_bundle : Lrc < FluentBundle > ,
744
+ fallback_bundle : LazyFallbackBundle ,
744
745
short_message : bool ,
745
746
teach : bool ,
746
747
colored : bool ,
0 commit comments