Skip to content

Commit 9fe4a4e

Browse files
committed
Add some debug logging for cargo fix
1 parent 216f915 commit 9fe4a4e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cargo/ops/fix.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ pub fn fix_maybe_exec_rustc(config: &Config) -> CargoResult<bool> {
363363
let mut cmd = rustc.build_command();
364364
args.apply(&mut cmd, config);
365365
cmd.arg("--error-format=json");
366+
debug!("calling rustc for final verification: {:?}", cmd);
366367
let output = cmd.output().context("failed to spawn rustc")?;
367368

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

@@ -541,6 +544,10 @@ fn rustfix_and_fix(
541544
let mut cmd = rustc.build_command();
542545
cmd.arg("--error-format=json");
543546
args.apply(&mut cmd, config);
547+
debug!(
548+
"calling rustc to collect suggestions and validate previous fixes: {:?}",
549+
cmd
550+
);
544551
let output = cmd.output().with_context(|| {
545552
format!(
546553
"failed to execute `{}`",
@@ -605,6 +612,7 @@ fn rustfix_and_fix(
605612
continue;
606613
}
607614

615+
trace!("adding suggestion for {:?}: {:?}", file_name, suggestion);
608616
file_map
609617
.entry(file_name)
610618
.or_insert_with(Vec::new)

0 commit comments

Comments
 (0)