From ecfc89963605634c297510de366fdf50ef08f678 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 25 Aug 2024 16:03:11 -0400 Subject: [PATCH] Log details of failure if no errors were seen --- src/cargo/core/compiler/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index 7c9a8901e28..310e4f2a84b 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -409,7 +409,17 @@ fn rustc( ) }, ) - .map_err(verbose_if_simple_exit_code) + .map_err(|e| { + if output_options.errors_seen == 0 { + // If we didn't expect an error, do not require --verbose to fail. + // This is intended to debug + // https://github.com/rust-lang/crater/issues/733, where we are seeing + // Cargo exit unsuccessfully while seeming to not show any errors. + e + } else { + verbose_if_simple_exit_code(e) + } + }) .with_context(|| { // adapted from rustc_errors/src/lib.rs let warnings = match output_options.warnings_seen {