]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/tool.rs
Clean tools after building libstd/libtest/librustc.
[rust.git] / src / bootstrap / tool.rs
index 3043c95b5f07ed074478099ed5ff1f3421d81178..7ccd527b33874ab0c5de6af03e6f02f727544bd5 100644 (file)
 use cache::Interned;
 
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
-struct CleanTools {
-    compiler: Compiler,
-    target: Interned<String>,
-    mode: Mode,
+pub struct CleanTools {
+    pub compiler: Compiler,
+    pub target: Interned<String>,
+    pub mode: Mode,
 }
 
 impl Step for CleanTools {
@@ -82,7 +82,6 @@ fn run(self, builder: &Builder) -> PathBuf {
         let target = self.target;
         let tool = self.tool;
 
-        builder.ensure(CleanTools { compiler, target, mode: self.mode });
         match self.mode {
             Mode::Libstd => builder.ensure(compile::Std { compiler, target }),
             Mode::Libtest => builder.ensure(compile::Test { compiler, target }),
@@ -236,7 +235,7 @@ fn run(self, builder: &Builder) -> PathBuf {
 
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
 pub struct Rustdoc {
-    pub target_compiler: Compiler,
+    pub host: Interned<String>,
 }
 
 impl Step for Rustdoc {
@@ -250,16 +249,20 @@ fn should_run(run: ShouldRun) -> ShouldRun {
 
     fn make_run(run: RunConfig) {
         run.builder.ensure(Rustdoc {
-            target_compiler: run.builder.compiler(run.builder.top_stage, run.host),
+            host: run.host,
         });
     }
 
     fn run(self, builder: &Builder) -> PathBuf {
         let build = builder.build;
-        let target_compiler = self.target_compiler;
+        let target_compiler = builder.compiler(builder.top_stage, self.host);
         let target = target_compiler.host;
         let build_compiler = if target_compiler.stage == 0 {
             builder.compiler(0, builder.build.build)
+        } else if target_compiler.stage >= 2 {
+            // Past stage 2, we consider the compiler to be ABI-compatible and hence capable of
+            // building rustdoc itself.
+            target_compiler
         } else {
             // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
             // we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
@@ -267,7 +270,6 @@ fn run(self, builder: &Builder) -> PathBuf {
             builder.compiler(target_compiler.stage - 1, builder.build.build)
         };
 
-        builder.ensure(CleanTools { compiler: build_compiler, target, mode: Mode::Librustc });
         builder.ensure(compile::Rustc { compiler: build_compiler, target });
 
         let _folder = build.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));