Skip to content

Commit 4db2394

Browse files
committed
Auto merge of #57680 - cuviper:codegen-rebuild, r=Mark-Simulacrum
[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.
2 parents d38d6be + 9b8c3c4 commit 4db2394

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bootstrap/builder.rs

+12
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,15 @@ impl<'a> Builder<'a> {
660660
}
661661
}
662662

663+
/// Get the paths to all of the compiler's codegen backends.
664+
fn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf> {
665+
fs::read_dir(self.sysroot_codegen_backends(compiler))
666+
.into_iter()
667+
.flatten()
668+
.filter_map(Result::ok)
669+
.map(|entry| entry.path())
670+
}
671+
663672
pub fn rustdoc(&self, host: Interned<String>) -> PathBuf {
664673
self.ensure(tool::Rustdoc { host })
665674
}
@@ -750,6 +759,9 @@ impl<'a> Builder<'a> {
750759
match mode {
751760
Mode::Std => {
752761
self.clear_if_dirty(&my_out, &self.rustc(compiler));
762+
for backend in self.codegen_backends(compiler) {
763+
self.clear_if_dirty(&my_out, &backend);
764+
}
753765
},
754766
Mode::Test => {
755767
self.clear_if_dirty(&my_out, &libstd_stamp);

0 commit comments

Comments
 (0)