diff options
| author | bors <bors@rust-lang.org> | 2024-08-09 00:17:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-09 00:17:32 +0000 |
| commit | fac77538022b32b4298833b541feb457ca4548b0 (patch) | |
| tree | 6b0feefba5efee1b5a5c9cc1f14656181f7e16a5 /compiler/rustc_errors/src/json.rs | |
| parent | c7b0d4e81f56da02d41f73fb5a85673a29f6cbc9 (diff) | |
| parent | 9243aeecdaa06f64bf75362227383c3f6d827cfe (diff) | |
| download | rust-fac77538022b32b4298833b541feb457ca4548b0.tar.gz rust-fac77538022b32b4298833b541feb457ca4548b0.zip | |
Auto merge of #128853 - matthiaskrgr:rollup-pr222x1, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #128640 (rwlock: disable 'frob' test in Miri on macOS) - #128791 (Don't implement `AsyncFn` for `FnDef`/`FnPtr` that wouldnt implement `Fn`) - #128806 (Split `ColorConfig` off of `HumanReadableErrorType`) - #128818 (std float tests: special-case Miri in feature detection) - #128834 (rustdoc: strip unreachable modules) - #128836 (rustdoc-json: add a test for impls on private & hidden types) - #128837 (Clippy subtree update) - #128851 (Add comment that bors did not see pushed before it merged) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src/json.rs')
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 42a28bc7890..32e59f9ab03 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -55,6 +55,7 @@ pub struct JsonEmitter { ignored_directories_in_source_blocks: Vec<String>, #[setters(skip)] json_rendered: HumanReadableErrorType, + color_config: ColorConfig, diagnostic_width: Option<usize>, macro_backtrace: bool, track_diagnostics: bool, @@ -68,6 +69,7 @@ impl JsonEmitter { fallback_bundle: LazyFallbackBundle, pretty: bool, json_rendered: HumanReadableErrorType, + color_config: ColorConfig, ) -> JsonEmitter { JsonEmitter { dst: IntoDynSyncSend(dst), @@ -79,6 +81,7 @@ impl JsonEmitter { ui_testing: false, ignored_directories_in_source_blocks: Vec::new(), json_rendered, + color_config, diagnostic_width: None, macro_backtrace: false, track_diagnostics: false, @@ -173,7 +176,7 @@ impl Emitter for JsonEmitter { } fn should_show_explain(&self) -> bool { - !matches!(self.json_rendered, HumanReadableErrorType::Short(_)) + !self.json_rendered.short() } } @@ -353,8 +356,8 @@ impl Diagnostic { let buf = BufWriter::default(); let mut dst: Destination = Box::new(buf.clone()); - let (short, color_config) = je.json_rendered.unzip(); - match color_config { + let short = je.json_rendered.short(); + match je.color_config { ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)), ColorConfig::Never => {} } |
