about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2023-12-14 20:25:09 +0300
committeronur-ozkan <work@onurozkan.dev>2023-12-14 23:05:44 +0300
commitbf0de6c6791cf9cb1ddedaabf140566cc2216f50 (patch)
treea66941b9d4d381340baa4073e3d43d2fae7cf9f2
parent9d49eb76c47a139ef71da4ab56aa9aeca5f24913 (diff)
downloadrust-bf0de6c6791cf9cb1ddedaabf140566cc2216f50.tar.gz
rust-bf0de6c6791cf9cb1ddedaabf140566cc2216f50.zip
fix `x clean` for cross-compiled artifacts
Signed-off-by: onur-ozkan <work@onurozkan.dev>
-rw-r--r--src/bootstrap/src/core/build_steps/clean.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs
index 6372db96afb..4b993945f19 100644
--- a/src/bootstrap/src/core/build_steps/clean.rs
+++ b/src/bootstrap/src/core/build_steps/clean.rs
@@ -149,8 +149,14 @@ fn clean_default(build: &Build) {
     rm_rf(&build.out.join("bootstrap-shims-dump"));
     rm_rf(&build.out.join("rustfmt.stamp"));
 
-    for host in &build.hosts {
-        let entries = match build.out.join(host.triple).read_dir() {
+    let mut hosts: Vec<_> = build.hosts.iter().map(|t| build.out.join(t.triple)).collect();
+    // After cross-compilation, artifacts of the host architecture (which may differ from build.host)
+    // might not get removed.
+    // Adding its path (linked one for easier accessibility) will solve this problem.
+    hosts.push(build.out.join("host"));
+
+    for host in hosts {
+        let entries = match host.read_dir() {
             Ok(iter) => iter,
             Err(_) => continue,
         };