Skip to content

Commit 247063c

Browse files
committed
Update some fix comments.
1 parent 9733561 commit 247063c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/cargo/ops/fix.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
//! to print at the same time).
1616
//!
1717
//! Cargo begins a normal `cargo check` operation with itself set as a proxy
18-
//! for rustc by setting `cargo_as_rustc_wrapper` in the build config. When
18+
//! for rustc by setting `rustc_wrapper` in the build config. When
1919
//! cargo launches rustc to check a crate, it is actually launching itself.
2020
//! The `FIX_ENV` environment variable is set so that cargo knows it is in
21-
//! fix-proxy-mode. It also sets the `RUSTC` environment variable to the
22-
//! actual rustc so Cargo knows what to execute.
21+
//! fix-proxy-mode.
2322
//!
2423
//! Each proxied cargo-as-rustc detects it is in fix-proxy-mode (via `FIX_ENV`
2524
//! environment variable in `main`) and does the following:
@@ -198,9 +197,8 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
198197
// That's very likely to only mean the crates in the workspace the user is
199198
// working on, not random crates.io crates.
200199
//
201-
// To that end we only actually try to fix things if it looks like we're
202-
// compiling a Rust file and it *doesn't* have an absolute filename. That's
203-
// not the best heuristic but matches what Cargo does today at least.
200+
// The master cargo process tells us whether or not this is a "primary"
201+
// crate via the CARGO_PRIMARY_PACKAGE environment variable.
204202
let mut fixes = FixedCrate::default();
205203
if let Some(path) = &args.file {
206204
if args.primary_package {
@@ -254,6 +252,11 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
254252
}
255253
}
256254

255+
// This final fall-through handles multiple cases;
256+
// - Non-primary crates, which need to be built.
257+
// - If the fix failed, show the original warnings and suggestions.
258+
// - If `--broken-code`, show the error messages.
259+
// - If the fix succeeded, show any remaining warnings.
257260
let mut cmd = Command::new(&rustc);
258261
args.apply(&mut cmd);
259262
exit_with(cmd.status().context("failed to spawn rustc")?);

0 commit comments

Comments
 (0)