diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 3b3b062b151..df15cbc9314 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -562,7 +562,12 @@ fn run(self, builder: &Builder) { cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler)); cmd.arg("--run-lib-path").arg(builder.sysroot_libdir(compiler, target)); cmd.arg("--rustc-path").arg(builder.rustc(compiler)); - cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler)); + + // Avoid depending on rustdoc when we don't need it. + if mode == "rustdoc" || mode == "run-make" { + cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler)); + } + cmd.arg("--src-base").arg(build.src.join("src/test").join(suite)); cmd.arg("--build-base").arg(testdir(build, compiler.host).join(suite)); cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target)); diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index cc95e1b8930..0d6b350a1d4 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -93,7 +93,7 @@ pub struct Config { pub rustc_path: PathBuf, // The rustdoc executable - pub rustdoc_path: PathBuf, + pub rustdoc_path: Option, // The python executable to use for LLDB pub lldb_python: String, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 91f80a7afec..6fa758aeabe 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -67,7 +67,7 @@ pub fn parse_config(args: Vec ) -> Config { opts.reqopt("", "compile-lib-path", "path to host shared libraries", "PATH") .reqopt("", "run-lib-path", "path to target shared libraries", "PATH") .reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH") - .reqopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH") + .optopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH") .reqopt("", "lldb-python", "path to python to use for doc tests", "PATH") .reqopt("", "docck-python", "path to python to use for doc tests", "PATH") .optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM") @@ -157,7 +157,7 @@ fn make_absolute(path: PathBuf) -> PathBuf { compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")), run_lib_path: make_absolute(opt_path(matches, "run-lib-path")), rustc_path: opt_path(matches, "rustc-path"), - rustdoc_path: opt_path(matches, "rustdoc-path"), + rustdoc_path: matches.opt_str("rustdoc-path").map(PathBuf::from), lldb_python: matches.opt_str("lldb-python").unwrap(), docck_python: matches.opt_str("docck-python").unwrap(), valgrind_path: matches.opt_str("valgrind-path"), @@ -210,7 +210,7 @@ pub fn log_config(config: &Config) { logv(c, format!("compile_lib_path: {:?}", config.compile_lib_path)); logv(c, format!("run_lib_path: {:?}", config.run_lib_path)); logv(c, format!("rustc_path: {:?}", config.rustc_path.display())); - logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path.display())); + logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path)); logv(c, format!("src_base: {:?}", config.src_base.display())); logv(c, format!("build_base: {:?}", config.build_base.display())); logv(c, format!("stage_id: {}", config.stage_id)); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c6dc78ef505..93696561708 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1192,7 +1192,8 @@ fn document(&self, out_dir: &Path) -> ProcRes { self.testpaths.file.to_str().unwrap().to_owned()]; args.extend(self.props.compile_flags.iter().cloned()); let args = ProcArgs { - prog: self.config.rustdoc_path.to_str().unwrap().to_owned(), + prog: self.config.rustdoc_path + .as_ref().expect("--rustdoc-path passed").to_str().unwrap().to_owned(), args: args, }; self.compose_and_run_compiler(args, None) @@ -2163,7 +2164,8 @@ fn run_rmake_test(&self) { .env("S", src_root) .env("RUST_BUILD_STAGE", &self.config.stage_id) .env("RUSTC", cwd.join(&self.config.rustc_path)) - .env("RUSTDOC", cwd.join(&self.config.rustdoc_path)) + .env("RUSTDOC", + cwd.join(&self.config.rustdoc_path.as_ref().expect("--rustdoc-path passed"))) .env("TMPDIR", &tmpdir) .env("LD_LIB_PATH_ENVVAR", procsrv::dylib_env_var()) .env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))