Skip to content

Commit

Permalink
Rollup merge of #122737 - ytmimi:conditionally_ignore_fatal_diagnosti…
Browse files Browse the repository at this point in the history
…c, r=davidtwco

conditionally ignore fatal diagnostic in the SilentEmitter

This change is primarily meant to allow rustfmt to ignore all diagnostics when using the `SilentEmitter`. Back in #121301 the `SilentEmitter` was shared between rustc and rustfmt. This changed rustfmt's behavior from ignoring all diagnostic to emitting fatal diagnostics, which lead to rust-lang#6109.

These changes allow rustfmt to maintain its previous behaviour when using the `SilentEmitter`, while allowing rustc code to still emit fatal diagnostics.
  • Loading branch information
matthiaskrgr authored Mar 24, 2024
2 parents 0aa66d1 + 911f6a4 commit 5e141e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parse/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ fn default_dcx(
fallback_bundle,
fatal_dcx: DiagCtxt::new(emitter),
fatal_note: None,
emit_fatal_diagnostic: false,
})
} else {
emitter
Expand Down Expand Up @@ -209,7 +210,7 @@ impl ParseSess {
rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
false,
);
self.raw_psess.dcx.make_silent(fallback_bundle, None);
self.raw_psess.dcx.make_silent(fallback_bundle, None, false);
}

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

0 comments on commit 5e141e0

Please sign in to comment.