@@ -24,6 +24,7 @@ use crate::{
2424} ;
2525use rustc_lint_defs:: pluralize;
2626
27+ use derive_setters:: Setters ;
2728use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
2829use rustc_data_structures:: sync:: Lrc ;
2930use rustc_error_messages:: { FluentArgs , SpanLabel } ;
@@ -639,10 +640,13 @@ impl ColorConfig {
639640}
640641
641642/// Handles the writing of `HumanReadableErrorType::Default` and `HumanReadableErrorType::Short`
643+ #[ derive( Setters ) ]
642644pub struct EmitterWriter {
645+ #[ setters( skip) ]
643646 dst : Destination ,
644647 sm : Option < Lrc < SourceMap > > ,
645648 fluent_bundle : Option < Lrc < FluentBundle > > ,
649+ #[ setters( skip) ]
646650 fallback_bundle : LazyFallbackBundle ,
647651 short_message : bool ,
648652 teach : bool ,
@@ -662,31 +666,20 @@ pub struct FileWithAnnotatedLines {
662666}
663667
664668impl EmitterWriter {
665- pub fn stderr (
666- color_config : ColorConfig ,
667- source_map : Option < Lrc < SourceMap > > ,
668- fluent_bundle : Option < Lrc < FluentBundle > > ,
669- fallback_bundle : LazyFallbackBundle ,
670- short_message : bool ,
671- teach : bool ,
672- diagnostic_width : Option < usize > ,
673- macro_backtrace : bool ,
674- track_diagnostics : bool ,
675- terminal_url : TerminalUrl ,
676- ) -> EmitterWriter {
669+ pub fn stderr ( color_config : ColorConfig , fallback_bundle : LazyFallbackBundle ) -> EmitterWriter {
677670 let dst = Destination :: from_stderr ( color_config) ;
678671 EmitterWriter {
679672 dst,
680- sm : source_map ,
681- fluent_bundle,
673+ sm : None ,
674+ fluent_bundle : None ,
682675 fallback_bundle,
683- short_message,
684- teach,
676+ short_message : false ,
677+ teach : false ,
685678 ui_testing : false ,
686- diagnostic_width,
687- macro_backtrace,
688- track_diagnostics,
689- terminal_url,
679+ diagnostic_width : None ,
680+ macro_backtrace : false ,
681+ track_diagnostics : false ,
682+ terminal_url : TerminalUrl :: No ,
690683 }
691684 }
692685
@@ -718,11 +711,6 @@ impl EmitterWriter {
718711 }
719712 }
720713
721- pub fn ui_testing ( mut self , ui_testing : bool ) -> Self {
722- self . ui_testing = ui_testing;
723- self
724- }
725-
726714 fn maybe_anonymized ( & self , line_num : usize ) -> Cow < ' static , str > {
727715 if self . ui_testing {
728716 Cow :: Borrowed ( ANONYMIZED_LINE_NUM )
0 commit comments