diff options
| author | Yacin Tmimi <yacintmimi@gmail.com> | 2024-03-19 12:58:23 -0400 |
|---|---|---|
| committer | Yacin Tmimi <yacintmimi@gmail.com> | 2024-03-19 13:48:07 -0400 |
| commit | d49d136b3a0e9749e4aa517b7aa6490752444cf7 (patch) | |
| tree | f5313908038b97c3f06aeb6103ffb5eb2c2e2ae8 /compiler/rustc_session/src/parse.rs | |
| parent | 200e3f7995e231535fdea3be9cb9a3f098b4c856 (diff) | |
| download | rust-d49d136b3a0e9749e4aa517b7aa6490752444cf7.tar.gz rust-d49d136b3a0e9749e4aa517b7aa6490752444cf7.zip | |
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 PR 121301 the `SilentEmitter` was shared between rustc and rustfmt. This changed rustfmt's behavior from ignoring all diagnostic to emitting fatal diagnostics. These changes allow rustfmt to maintain it's previous behaviour when using the SilentEmitter, while allowing rustc code to still emit fatal diagnostics.
Diffstat (limited to 'compiler/rustc_session/src/parse.rs')
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 5434bbe0b98..f6053f43fbd 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -269,7 +269,11 @@ impl ParseSess { } } - pub fn with_silent_emitter(locale_resources: Vec<&'static str>, fatal_note: String) -> Self { + pub fn with_silent_emitter( + locale_resources: Vec<&'static str>, + fatal_note: String, + emit_fatal_diagnostic: bool, + ) -> Self { let fallback_bundle = fallback_fluent_bundle(locale_resources, false); let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let emitter = Box::new(HumanEmitter::new( @@ -281,6 +285,7 @@ impl ParseSess { fallback_bundle, fatal_dcx, fatal_note: Some(fatal_note), + emit_fatal_diagnostic, })) .disable_warnings(); ParseSess::with_dcx(dcx, sm) |
