@@ -13,9 +13,10 @@ use crate::Session;
1313use rustc_ast:: node_id:: NodeId ;
1414use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap , FxIndexSet } ;
1515use rustc_data_structures:: sync:: { AppendOnlyVec , Lock , Lrc } ;
16- use rustc_errors:: { emitter:: SilentEmitter , DiagCtxt } ;
16+ use rustc_errors:: emitter:: { HumanEmitter , SilentEmitter } ;
1717use rustc_errors:: {
18- fallback_fluent_bundle, Diag , DiagnosticMessage , EmissionGuarantee , MultiSpan , StashKey ,
18+ fallback_fluent_bundle, ColorConfig , Diag , DiagCtxt , DiagnosticMessage , EmissionGuarantee ,
19+ MultiSpan , StashKey ,
1920} ;
2021use rustc_feature:: { find_feature_issue, GateIssue , UnstableFeatures } ;
2122use rustc_span:: edition:: Edition ;
@@ -236,7 +237,9 @@ impl ParseSess {
236237 pub fn new ( locale_resources : Vec < & ' static str > , file_path_mapping : FilePathMapping ) -> Self {
237238 let fallback_bundle = fallback_fluent_bundle ( locale_resources, false ) ;
238239 let sm = Lrc :: new ( SourceMap :: new ( file_path_mapping) ) ;
239- let dcx = DiagCtxt :: with_tty_emitter ( Some ( sm. clone ( ) ) , fallback_bundle) ;
240+ let emitter =
241+ Box :: new ( HumanEmitter :: stderr ( ColorConfig :: Auto , fallback_bundle) . sm ( Some ( sm. clone ( ) ) ) ) ;
242+ let dcx = DiagCtxt :: with_emitter ( emitter) ;
240243 ParseSess :: with_dcx ( dcx, sm)
241244 }
242245
@@ -265,7 +268,8 @@ impl ParseSess {
265268 pub fn with_silent_emitter ( fatal_note : String ) -> Self {
266269 let fallback_bundle = fallback_fluent_bundle ( Vec :: new ( ) , false ) ;
267270 let sm = Lrc :: new ( SourceMap :: new ( FilePathMapping :: empty ( ) ) ) ;
268- let fatal_dcx = DiagCtxt :: with_tty_emitter ( None , fallback_bundle) . disable_warnings ( ) ;
271+ let emitter = Box :: new ( HumanEmitter :: stderr ( ColorConfig :: Auto , fallback_bundle) ) ;
272+ let fatal_dcx = DiagCtxt :: with_emitter ( emitter) ;
269273 let dcx = DiagCtxt :: with_emitter ( Box :: new ( SilentEmitter { fatal_dcx, fatal_note } ) )
270274 . disable_warnings ( ) ;
271275 ParseSess :: with_dcx ( dcx, sm)
0 commit comments