Skip to content

Commit 9d41535

Browse files
committed
Work-around lack of artifact dependencies when using cargo run -p bootstrap
While working on rust-lang#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.
1 parent 85ce7fd commit 9d41535

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bootstrap/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,7 @@ impl Build {
442442
let workspace_target_dir = std::env::var("CARGO_TARGET_DIR")
443443
.map(PathBuf::from)
444444
.unwrap_or_else(|_| src.join("target"));
445-
let bootstrap_out = workspace_target_dir.join("debug");
446-
if !bootstrap_out.join("rustc").exists() {
447-
// this restriction can be lifted whenever https://github.com/rust-lang/rfcs/pull/3028 is implemented
448-
panic!("run `cargo build --bins` before `cargo run`")
449-
}
450-
bootstrap_out
445+
workspace_target_dir.join("debug")
451446
};
452447

453448
let mut build = Build {
@@ -490,6 +485,11 @@ impl Build {
490485
tool_artifacts: Default::default(),
491486
};
492487

488+
if env::var("BOOTSTRAP_PYTHON").is_err() {
489+
// This can be removed whenever https://github.com/rust-lang/rfcs/pull/3028 is implemented.
490+
build.run(Command::new(env!("CARGO")).args(&["build", "-p", "bootstrap", "--bins"]));
491+
}
492+
493493
build.verbose("finding compilers");
494494
cc_detect::find(&mut build);
495495
// When running `setup`, the profile is about to change, so any requirements we have now may

0 commit comments

Comments
 (0)