about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2019-01-16 13:13:58 -0800
committerJosh Stone <jistone@redhat.com>2019-01-16 13:13:58 -0800
commit9b8c3c4cff4302a50fc8c82a18f10fc97b0fb3b7 (patch)
treee6ae684cfdbb953f6b6b36b874b9868607708b4c
parentceb2512144d1fc26330e85fb9d41c22ba1866259 (diff)
downloadrust-9b8c3c4cff4302a50fc8c82a18f10fc97b0fb3b7.tar.gz
rust-9b8c3c4cff4302a50fc8c82a18f10fc97b0fb3b7.zip
[rustbuild] Rebuild std after changes to codegen backends
Use `clear_if_dirty` on std for backend changes, just as we do for
changes to rustc itself, so new codegen is correctly applied to all
later compiler stages.

Fixes #48298.
-rw-r--r--src/bootstrap/builder.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 9c58f5b179f..31adab64f60 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -660,6 +660,15 @@ impl<'a> Builder<'a> {
         }
     }
 
+    /// Get the paths to all of the compiler's codegen backends.
+    fn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf> {
+        fs::read_dir(self.sysroot_codegen_backends(compiler))
+            .into_iter()
+            .flatten()
+            .filter_map(Result::ok)
+            .map(|entry| entry.path())
+    }
+
     pub fn rustdoc(&self, host: Interned<String>) -> PathBuf {
         self.ensure(tool::Rustdoc { host })
     }
@@ -750,6 +759,9 @@ impl<'a> Builder<'a> {
             match mode {
                 Mode::Std => {
                     self.clear_if_dirty(&my_out, &self.rustc(compiler));
+                    for backend in self.codegen_backends(compiler) {
+                        self.clear_if_dirty(&my_out, &backend);
+                    }
                 },
                 Mode::Test => {
                     self.clear_if_dirty(&my_out, &libstd_stamp);