about summary refs log tree commit diff
path: root/compiler/rustc_session/src/parse.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-29 11:40:50 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-29 16:30:12 +1100
commitf9eef38e32f5e362006122d4a11d8e1f41e2f033 (patch)
tree9357eca5622bfd48a9dbb700fc7005a388368c21 /compiler/rustc_session/src/parse.rs
parentca5b79ddf7325fa7f6a88c170edbffa1757b149e (diff)
downloadrust-f9eef38e32f5e362006122d4a11d8e1f41e2f033.tar.gz
rust-f9eef38e32f5e362006122d4a11d8e1f41e2f033.zip
Inline and remove `DiagCtxt::with_tty_emitter`
It only has two call sites, and one of those doesn't set the source map.
Diffstat (limited to 'compiler/rustc_session/src/parse.rs')
-rw-r--r--compiler/rustc_session/src/parse.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs
index 752bb05f3d7..c88a1186965 100644
--- a/compiler/rustc_session/src/parse.rs
+++ b/compiler/rustc_session/src/parse.rs
@@ -13,9 +13,10 @@ use crate::Session;
 use rustc_ast::node_id::NodeId;
 use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
 use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc};
-use rustc_errors::{emitter::SilentEmitter, DiagCtxt};
+use rustc_errors::emitter::{HumanEmitter, SilentEmitter};
 use rustc_errors::{
-    fallback_fluent_bundle, Diag, DiagnosticMessage, EmissionGuarantee, MultiSpan, StashKey,
+    fallback_fluent_bundle, ColorConfig, Diag, DiagCtxt, DiagnosticMessage, EmissionGuarantee,
+    MultiSpan, StashKey,
 };
 use rustc_feature::{find_feature_issue, GateIssue, UnstableFeatures};
 use rustc_span::edition::Edition;
@@ -236,7 +237,9 @@ impl ParseSess {
     pub fn new(locale_resources: Vec<&'static str>, file_path_mapping: FilePathMapping) -> Self {
         let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
         let sm = Lrc::new(SourceMap::new(file_path_mapping));
-        let dcx = DiagCtxt::with_tty_emitter(Some(sm.clone()), fallback_bundle);
+        let emitter =
+            Box::new(HumanEmitter::stderr(ColorConfig::Auto, fallback_bundle).sm(Some(sm.clone())));
+        let dcx = DiagCtxt::with_emitter(emitter);
         ParseSess::with_dcx(dcx, sm)
     }
 
@@ -265,7 +268,8 @@ impl ParseSess {
     pub fn with_silent_emitter(fatal_note: String) -> Self {
         let fallback_bundle = fallback_fluent_bundle(Vec::new(), false);
         let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-        let fatal_dcx = DiagCtxt::with_tty_emitter(None, fallback_bundle).disable_warnings();
+        let emitter = Box::new(HumanEmitter::stderr(ColorConfig::Auto, fallback_bundle));
+        let fatal_dcx = DiagCtxt::with_emitter(emitter);
         let dcx = DiagCtxt::with_emitter(Box::new(SilentEmitter { fatal_dcx, fatal_note }))
             .disable_warnings();
         ParseSess::with_dcx(dcx, sm)