|
15 | 15 | //! to print at the same time).
|
16 | 16 | //!
|
17 | 17 | //! 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 |
19 | 19 | //! cargo launches rustc to check a crate, it is actually launching itself.
|
20 | 20 | //! 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. |
23 | 22 | //!
|
24 | 23 | //! Each proxied cargo-as-rustc detects it is in fix-proxy-mode (via `FIX_ENV`
|
25 | 24 | //! environment variable in `main`) and does the following:
|
@@ -198,9 +197,8 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
|
198 | 197 | // That's very likely to only mean the crates in the workspace the user is
|
199 | 198 | // working on, not random crates.io crates.
|
200 | 199 | //
|
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. |
204 | 202 | let mut fixes = FixedCrate::default();
|
205 | 203 | if let Some(path) = &args.file {
|
206 | 204 | if args.primary_package {
|
@@ -254,6 +252,11 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
|
254 | 252 | }
|
255 | 253 | }
|
256 | 254 |
|
| 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. |
257 | 260 | let mut cmd = Command::new(&rustc);
|
258 | 261 | args.apply(&mut cmd);
|
259 | 262 | exit_with(cmd.status().context("failed to spawn rustc")?);
|
|
0 commit comments