diff options
Diffstat (limited to 'src/bootstrap/lib.rs')
| -rw-r--r-- | src/bootstrap/lib.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index c2780a232ed..2ae63858ff6 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -261,6 +261,7 @@ pub struct Build { // Properties derived from the above configuration src: PathBuf, out: PathBuf, + bootstrap_out: PathBuf, rust_info: channel::GitInfo, cargo_info: channel::GitInfo, rls_info: channel::GitInfo, @@ -435,6 +436,20 @@ impl Build { .expect("failed to read src/version"); let version = version.trim(); + let bootstrap_out = if std::env::var("BOOTSTRAP_PYTHON").is_ok() { + out.join("bootstrap").join("debug") + } else { + 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 + }; + let mut build = Build { initial_rustc: config.initial_rustc.clone(), initial_cargo: config.initial_cargo.clone(), @@ -453,6 +468,7 @@ impl Build { version: version.to_string(), src, out, + bootstrap_out, rust_info, cargo_info, |
