Skip to content

Commit

Permalink
Work-around lack of artifact dependencies when using `cargo run -p bo…
Browse files Browse the repository at this point in the history
…otstrap`

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.
  • Loading branch information
jyn514 committed Mar 10, 2022
1 parent 85ce7fd commit 9d41535
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9d41535

Please sign in to comment.