Skip to content

Commit

Permalink
Auto merge of rust-lang#57680 - cuviper:codegen-rebuild, r=Mark-Simul…
Browse files Browse the repository at this point in the history
…acrum

[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 rust-lang#48298.
  • Loading branch information
bors committed Jan 20, 2019
2 parents d38d6be + 9b8c3c4 commit 4db2394
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4db2394

Please sign in to comment.