@@ -13,9 +13,10 @@ use crate::Session;
13
13
use rustc_ast:: node_id:: NodeId ;
14
14
use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap , FxIndexSet } ;
15
15
use rustc_data_structures:: sync:: { AppendOnlyVec , Lock , Lrc } ;
16
- use rustc_errors:: { emitter:: SilentEmitter , DiagCtxt } ;
16
+ use rustc_errors:: emitter:: { HumanEmitter , SilentEmitter } ;
17
17
use rustc_errors:: {
18
- fallback_fluent_bundle, Diag , DiagnosticMessage , EmissionGuarantee , MultiSpan , StashKey ,
18
+ fallback_fluent_bundle, ColorConfig , Diag , DiagCtxt , DiagnosticMessage , EmissionGuarantee ,
19
+ MultiSpan , StashKey ,
19
20
} ;
20
21
use rustc_feature:: { find_feature_issue, GateIssue , UnstableFeatures } ;
21
22
use rustc_span:: edition:: Edition ;
@@ -236,7 +237,9 @@ impl ParseSess {
236
237
pub fn new ( locale_resources : Vec < & ' static str > , file_path_mapping : FilePathMapping ) -> Self {
237
238
let fallback_bundle = fallback_fluent_bundle ( locale_resources, false ) ;
238
239
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) ;
240
243
ParseSess :: with_dcx ( dcx, sm)
241
244
}
242
245
@@ -265,7 +268,8 @@ impl ParseSess {
265
268
pub fn with_silent_emitter ( fatal_note : String ) -> Self {
266
269
let fallback_bundle = fallback_fluent_bundle ( Vec :: new ( ) , false ) ;
267
270
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) ;
269
273
let dcx = DiagCtxt :: with_emitter ( Box :: new ( SilentEmitter { fatal_dcx, fatal_note } ) )
270
274
. disable_warnings ( ) ;
271
275
ParseSess :: with_dcx ( dcx, sm)
0 commit comments