Skip to content

Commit

Permalink
Add some debug logging for cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Aug 23, 2021
1 parent 216f915 commit 9fe4a4e
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 9fe4a4e

Please sign in to comment.