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

Update some fix comments. #7061

Merged
merged 1 commit into from
Jun 22, 2019
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
15 changes: 9 additions & 6 deletions src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
//! to print at the same time).
//!
//! Cargo begins a normal `cargo check` operation with itself set as a proxy
//! for rustc by setting `cargo_as_rustc_wrapper` in the build config. When
//! for rustc by setting `rustc_wrapper` in the build config. When
//! cargo launches rustc to check a crate, it is actually launching itself.
//! The `FIX_ENV` environment variable is set so that cargo knows it is in
//! fix-proxy-mode. It also sets the `RUSTC` environment variable to the
//! actual rustc so Cargo knows what to execute.
//! fix-proxy-mode.
//!
//! Each proxied cargo-as-rustc detects it is in fix-proxy-mode (via `FIX_ENV`
//! environment variable in `main`) and does the following:
Expand Down Expand Up @@ -198,9 +197,8 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
// That's very likely to only mean the crates in the workspace the user is
// working on, not random crates.io crates.
//
// To that end we only actually try to fix things if it looks like we're
// compiling a Rust file and it *doesn't* have an absolute filename. That's
// not the best heuristic but matches what Cargo does today at least.
// The master cargo process tells us whether or not this is a "primary"
// crate via the CARGO_PRIMARY_PACKAGE environment variable.
let mut fixes = FixedCrate::default();
if let Some(path) = &args.file {
if args.primary_package {
Expand Down Expand Up @@ -254,6 +252,11 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
}
}

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