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

Add some debug logging for cargo fix #9831

Merged
merged 1 commit into from
Aug 23, 2021
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
8 changes: 8 additions & 0 deletions src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ pub fn fix_maybe_exec_rustc(config: &Config) -> CargoResult<bool> {
let mut cmd = rustc.build_command();
args.apply(&mut cmd, config);
cmd.arg("--error-format=json");
debug!("calling rustc for final verification: {:?}", cmd);
let output = cmd.output().context("failed to spawn rustc")?;

if output.status.success() {
Expand All @@ -388,6 +389,7 @@ pub fn fix_maybe_exec_rustc(config: &Config) -> CargoResult<bool> {
if !output.status.success() {
if env::var_os(BROKEN_CODE_ENV).is_none() {
for (path, file) in fixes.files.iter() {
debug!("reverting {:?} due to errors", path);
paths::write(path, &file.original_code)?;
}
}
Expand All @@ -406,6 +408,7 @@ pub fn fix_maybe_exec_rustc(config: &Config) -> CargoResult<bool> {
// things like colored output to work correctly.
cmd.arg(arg);
}
debug!("calling rustc to display remaining diagnostics: {:?}", cmd);
exit_with(cmd.status().context("failed to spawn rustc")?);
}

Expand Down Expand Up @@ -541,6 +544,10 @@ fn rustfix_and_fix(
let mut cmd = rustc.build_command();
cmd.arg("--error-format=json");
args.apply(&mut cmd, config);
debug!(
"calling rustc to collect suggestions and validate previous fixes: {:?}",
cmd
);
let output = cmd.output().with_context(|| {
format!(
"failed to execute `{}`",
Expand Down Expand Up @@ -605,6 +612,7 @@ fn rustfix_and_fix(
continue;
}

trace!("adding suggestion for {:?}: {:?}", file_name, suggestion);
file_map
.entry(file_name)
.or_insert_with(Vec::new)
Expand Down