about summary refs log tree commit diff
path: root/src/bootstrap/bin
diff options
context:
space:
mode:
authorAidan Hobson Sayers <aidanhs@cantab.net>2016-12-24 16:04:48 +0000
committerAidan Hobson Sayers <aidanhs@cantab.net>2016-12-24 17:15:07 +0000
commitbabb7daf354d0c7224fa7fdb7638e520008f1815 (patch)
treefbcaff69a10887ccd63f1bdb5291a5ef8fa50783 /src/bootstrap/bin
parent17d873c2db77d029b8fe26d57b676e5797e99441 (diff)
Teach `rustdoc --test` about `--sysroot`, pass it when testing rust
This permits rustdoc tests to work in stage0
Diffstat (limited to 'src/bootstrap/bin')
-rw-r--r--src/bootstrap/bin/rustc.rs3
-rw-r--r--src/bootstrap/bin/rustdoc.rs3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 9cab6c423f5..129798836e0 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -67,6 +67,7 @@ fn main() {
         ("RUSTC_REAL", "RUSTC_LIBDIR")
     };
     let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
+    let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
 
     let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
     let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
@@ -83,7 +84,7 @@ fn main() {
     if let Some(target) = target {
         // The stage0 compiler has a special sysroot distinct from what we
         // actually downloaded, so we just always pass the `--sysroot` option.
-        cmd.arg("--sysroot").arg(env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"));
+        cmd.arg("--sysroot").arg(sysroot);
 
         // When we build Rust dylibs they're all intended for intermediate
         // usage, so make sure we pass the -Cprefer-dynamic flag instead of
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index a53bbe22eb9..e9ca430f158 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -25,6 +25,7 @@ fn main() {
     let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
     let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
     let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
+    let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
 
     let mut dylib_path = bootstrap::util::dylib_path();
     dylib_path.insert(0, PathBuf::from(libdir));
@@ -35,6 +36,8 @@ fn main() {
         .arg(format!("stage{}", stage))
         .arg("--cfg")
         .arg("dox")
+        .arg("--sysroot")
+        .arg(sysroot)
         .env(bootstrap::util::dylib_path_var(),
              env::join_paths(&dylib_path).unwrap());
     std::process::exit(match cmd.status() {