Fix x doc --stage 0 compiler
Eric figured out the fix to this almost 2 years ago, I just didn't read his comment carefully enough at the timme. The issue was that fake rustc and fake rustdoc were inconsistent about when they passed `--sysroot` to the real compiler. Change them to consistently only pass it when `--target` is present.
This commit is contained in:
parent
11909e3588
commit
064a55952e
@ -15,6 +15,10 @@ fn main() {
|
|||||||
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
|
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
|
||||||
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
|
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
|
||||||
|
|
||||||
|
// Detect whether or not we're a build script depending on whether --target
|
||||||
|
// is passed (a bit janky...)
|
||||||
|
let target = args.windows(2).find(|w| &*w[0] == "--target").and_then(|w| w[1].to_str());
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
let verbose = match env::var("RUSTC_VERBOSE") {
|
let verbose = match env::var("RUSTC_VERBOSE") {
|
||||||
@ -26,10 +30,18 @@ fn main() {
|
|||||||
dylib_path.insert(0, PathBuf::from(libdir.clone()));
|
dylib_path.insert(0, PathBuf::from(libdir.clone()));
|
||||||
|
|
||||||
let mut cmd = Command::new(rustdoc);
|
let mut cmd = Command::new(rustdoc);
|
||||||
cmd.args(&args)
|
|
||||||
.arg("--sysroot")
|
if target.is_some() {
|
||||||
.arg(&sysroot)
|
// The stage0 compiler has a special sysroot distinct from what we
|
||||||
.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
// actually downloaded, so we just always pass the `--sysroot` option,
|
||||||
|
// unless one is already set.
|
||||||
|
if !args.iter().any(|arg| arg == "--sysroot") {
|
||||||
|
cmd.arg("--sysroot").arg(&sysroot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.args(&args);
|
||||||
|
cmd.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||||
|
|
||||||
// Force all crates compiled by this compiler to (a) be unstable and (b)
|
// Force all crates compiled by this compiler to (a) be unstable and (b)
|
||||||
// allow the `rustc_private` feature to link to other unstable crates
|
// allow the `rustc_private` feature to link to other unstable crates
|
||||||
|
Loading…
Reference in New Issue
Block a user