diff --git a/src/cargo/core/compiler/context/mod.rs b/src/cargo/core/compiler/context/mod.rs index 79707b4f303..bda437fa099 100644 --- a/src/cargo/core/compiler/context/mod.rs +++ b/src/cargo/core/compiler/context/mod.rs @@ -513,6 +513,6 @@ impl<'a, 'cfg> Context<'a, 'cfg> { /// Returns whether when `unit` is built whether it should emit metadata as /// well because some compilations rely on that. pub fn rmeta_required(&self, unit: &Unit<'a>) -> bool { - self.rmeta_required.contains(unit) + self.rmeta_required.contains(unit) || self.bcx.config.cli_unstable().timings.is_some() } } diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index 447cd43329a..52cdcb82233 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -698,11 +698,10 @@ fn add_error_format_and_color( // prettily, and then when parsing JSON messages from rustc we need to // internally understand that we should extract the `rendered` field and // present it if we can. - let wants_artifacts = pipelined || cx.bcx.config.cli_unstable().timings.is_some(); - if cx.bcx.build_config.cache_messages() || wants_artifacts { + if cx.bcx.build_config.cache_messages() || pipelined { cmd.arg("--error-format=json"); let mut json = String::from("--json=diagnostic-rendered-ansi"); - if wants_artifacts { + if pipelined { json.push_str(",artifacts"); } match cx.bcx.build_config.message_format { @@ -1076,8 +1075,7 @@ struct OutputOptions { impl OutputOptions { fn new<'a>(cx: &Context<'a, '_>, unit: &Unit<'a>) -> OutputOptions { - let look_for_metadata_directive = - cx.rmeta_required(unit) || cx.bcx.config.cli_unstable().timings.is_some(); + let look_for_metadata_directive = cx.rmeta_required(unit); let color = cx.bcx.config.shell().supports_color(); let cache_cell = if cx.bcx.build_config.cache_messages() { let path = cx.files().message_cache_path(unit);