Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log details of failure if no errors were seen #14453

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/cargo/core/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbose_if_simple_exit_code doesn't do anything with --verbose so I am confused by the comment.

(I am also confused by verbose_if_simple_exit_code... the comment says that on signals and "abnormal termination", "don't hide the error details" -- but the code and function name seem to make it more verbose when it is a "simple" error, i.e. not a signal / abnormal termination.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see... VerboseError is an error that is less verbose, except if --verbose is passed then it is always verbose. That's quite confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Should have to rename it to something. Do you have any suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like SilenceErrorUnlessVerbose?

// 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 {
Expand Down
Loading