Rename SilentEmitter -> FatalOnlyEmitter
This commit is contained in:
parent
07b9bb1855
commit
316f63bc48
5 changed files with 10 additions and 10 deletions
|
|
@ -543,13 +543,13 @@ impl Emitter for HumanEmitter {
|
|||
/// An emitter that does nothing when emitting a non-fatal diagnostic.
|
||||
/// Fatal diagnostics are forwarded to `fatal_emitter` to avoid silent
|
||||
/// failures of rustc, as witnessed e.g. in issue #89358.
|
||||
pub struct SilentEmitter {
|
||||
pub struct FatalOnlyEmitter {
|
||||
pub fatal_emitter: Box<dyn Emitter + DynSend>,
|
||||
pub fatal_note: Option<String>,
|
||||
pub emit_fatal_diagnostic: bool,
|
||||
}
|
||||
|
||||
impl Emitter for SilentEmitter {
|
||||
impl Emitter for FatalOnlyEmitter {
|
||||
fn source_map(&self) -> Option<&SourceMap> {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ impl DiagCtxt {
|
|||
let mut inner = self.inner.borrow_mut();
|
||||
let mut prev_emitter = Box::new(FalseEmitter) as Box<dyn Emitter + DynSend>;
|
||||
std::mem::swap(&mut inner.emitter, &mut prev_emitter);
|
||||
let new_emitter = Box::new(emitter::SilentEmitter {
|
||||
let new_emitter = Box::new(emitter::FatalOnlyEmitter {
|
||||
fatal_emitter: prev_emitter,
|
||||
fatal_note,
|
||||
emit_fatal_diagnostic,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ pub struct Compiler {
|
|||
pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec<String>) -> Cfg {
|
||||
cfgs.into_iter()
|
||||
.map(|s| {
|
||||
let psess = ParseSess::with_silent_emitter(
|
||||
let psess = ParseSess::with_fatal_emitter(
|
||||
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
|
||||
format!("this error occurred on the command line: `--cfg={s}`"),
|
||||
true,
|
||||
|
|
@ -116,7 +116,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
|
|||
let mut check_cfg = CheckCfg { exhaustive_names, exhaustive_values, ..CheckCfg::default() };
|
||||
|
||||
for s in specs {
|
||||
let psess = ParseSess::with_silent_emitter(
|
||||
let psess = ParseSess::with_fatal_emitter(
|
||||
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
|
||||
format!("this error occurred on the command line: `--check-cfg={s}`"),
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use rustc_ast::attr::AttrIdGenerator;
|
|||
use rustc_ast::node_id::NodeId;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::sync::{AppendOnlyVec, Lock};
|
||||
use rustc_errors::emitter::{HumanEmitter, SilentEmitter, stderr_destination};
|
||||
use rustc_errors::emitter::{FatalOnlyEmitter, HumanEmitter, stderr_destination};
|
||||
use rustc_errors::translation::Translator;
|
||||
use rustc_errors::{
|
||||
ColorConfig, Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, EmissionGuarantee, MultiSpan,
|
||||
|
|
@ -275,7 +275,7 @@ impl ParseSess {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn with_silent_emitter(
|
||||
pub fn with_fatal_emitter(
|
||||
locale_resources: Vec<&'static str>,
|
||||
fatal_note: String,
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ impl ParseSess {
|
|||
let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let fatal_emitter =
|
||||
Box::new(HumanEmitter::new(stderr_destination(ColorConfig::Auto), translator));
|
||||
let dcx = DiagCtxt::new(Box::new(SilentEmitter {
|
||||
let dcx = DiagCtxt::new(Box::new(FatalOnlyEmitter {
|
||||
fatal_emitter,
|
||||
fatal_note: Some(fatal_note),
|
||||
emit_fatal_diagnostic,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use rustc_data_structures::sync::IntoDynSyncSend;
|
||||
use rustc_errors::emitter::{DynEmitter, Emitter, HumanEmitter, SilentEmitter, stderr_destination};
|
||||
use rustc_errors::emitter::{DynEmitter, Emitter, HumanEmitter, FatalOnlyEmitter, stderr_destination};
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::translation::Translator;
|
||||
use rustc_errors::{ColorConfig, Diag, DiagCtxt, DiagInner, Level as DiagnosticLevel};
|
||||
|
|
@ -111,7 +111,7 @@ fn default_dcx(
|
|||
);
|
||||
|
||||
let emitter: Box<DynEmitter> = if !show_parse_errors {
|
||||
Box::new(SilentEmitter {
|
||||
Box::new(FatalOnlyEmitter {
|
||||
fatal_emitter: emitter,
|
||||
fatal_note: None,
|
||||
emit_fatal_diagnostic: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue