Skip to content

Commit ced2bb0

Browse files
committed
Extract SilentEmitter
1 parent e9d0738 commit ced2bb0

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/parse/session.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use std::sync::atomic::{AtomicBool, Ordering};
44

55
use rustc_data_structures::sync::IntoDynSyncSend;
6-
use rustc_errors::emitter::{DynEmitter, Emitter, HumanEmitter, FatalOnlyEmitter, stderr_destination};
6+
use rustc_errors::emitter::{DynEmitter, Emitter, HumanEmitter, SilentEmitter, stderr_destination};
77
use rustc_errors::registry::Registry;
88
use rustc_errors::translation::Translator;
99
use rustc_errors::{ColorConfig, Diag, DiagCtxt, DiagInner, Level as DiagnosticLevel};
@@ -105,19 +105,14 @@ fn default_dcx(
105105
};
106106

107107
let translator = rustc_driver::default_translator();
108-
let emitter = Box::new(
109-
HumanEmitter::new(stderr_destination(emit_color), translator)
110-
.sm(Some(source_map.clone())),
111-
);
112-
113-
let emitter: Box<DynEmitter> = if !show_parse_errors {
114-
Box::new(FatalOnlyEmitter {
115-
fatal_emitter: emitter,
116-
fatal_note: None,
117-
emit_fatal_diagnostic: false,
118-
})
108+
109+
let emitter: Box<DynEmitter> = if show_parse_errors {
110+
Box::new(
111+
HumanEmitter::new(stderr_destination(emit_color), translator)
112+
.sm(Some(source_map.clone())),
113+
)
119114
} else {
120-
emitter
115+
Box::new(SilentEmitter { translator })
121116
};
122117
DiagCtxt::new(Box::new(SilentOnIgnoredFilesEmitter {
123118
has_non_ignorable_parser_errors: false,
@@ -196,7 +191,7 @@ impl ParseSess {
196191
}
197192

198193
pub(crate) fn set_silent_emitter(&mut self) {
199-
self.raw_psess.dcx().make_silent(None, false);
194+
self.raw_psess.dcx().make_silent();
200195
}
201196

202197
pub(crate) fn span_to_filename(&self, span: Span) -> FileName {

0 commit comments

Comments
 (0)