From 9d4153558ba5af3f0e19223c7e3bc23243c3829b Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 10 Mar 2022 17:32:40 -0600 Subject: [PATCH] Work-around lack of artifact dependencies when using `cargo run -p bootstrap` While working on https://github.com/rust-lang/rust/pull/94806, I was very confused because the `trim()` fix didn't actually do anything and still errored out. It turns out the issue was that bootstrap had been rebuilt, but not fake rustc. Rebuild all the fake binaries automatically from within bootstrap to avoid issues like this in the future. --- src/bootstrap/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 2ae63858ff610..6a236a4380ae6 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -442,12 +442,7 @@ impl Build { let workspace_target_dir = std::env::var("CARGO_TARGET_DIR") .map(PathBuf::from) .unwrap_or_else(|_| src.join("target")); - let bootstrap_out = workspace_target_dir.join("debug"); - if !bootstrap_out.join("rustc").exists() { - // this restriction can be lifted whenever https://github.com/rust-lang/rfcs/pull/3028 is implemented - panic!("run `cargo build --bins` before `cargo run`") - } - bootstrap_out + workspace_target_dir.join("debug") }; let mut build = Build { @@ -490,6 +485,11 @@ impl Build { tool_artifacts: Default::default(), }; + if env::var("BOOTSTRAP_PYTHON").is_err() { + // This can be removed whenever https://github.com/rust-lang/rfcs/pull/3028 is implemented. + build.run(Command::new(env!("CARGO")).args(&["build", "-p", "bootstrap", "--bins"])); + } + build.verbose("finding compilers"); cc_detect::find(&mut build); // When running `setup`, the profile is about to change, so any requirements we have now may