Skip to content

Commit e719b6f

Browse files
committed
Auto merge of rust-lang#118946 - onur-ozkan:fix-clean, r=clubby789
fix `x clean` for cross-compiled artifacts ```toml build = "x86_64-unknown-linux-gnu" host = ["arm-unknown-linux-gnueabihf"] target = ["arm-unknown-linux-gnueabihf"] ``` On `x86_64-unknown-linux-gnu`, after cross-compiling with the sample configuration above, artifacts under `build/x86_64-unknown-linux-gnu` never gets cleaned with `x clean`. This PR fixes that.
2 parents 3f28fe1 + bf0de6c commit e719b6f

File tree

1 file changed

+8
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+8
-2
lines changed

src/bootstrap/src/core/build_steps/clean.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,14 @@ fn clean_default(build: &Build) {
149149
rm_rf(&build.out.join("bootstrap-shims-dump"));
150150
rm_rf(&build.out.join("rustfmt.stamp"));
151151

152-
for host in &build.hosts {
153-
let entries = match build.out.join(host.triple).read_dir() {
152+
let mut hosts: Vec<_> = build.hosts.iter().map(|t| build.out.join(t.triple)).collect();
153+
// After cross-compilation, artifacts of the host architecture (which may differ from build.host)
154+
// might not get removed.
155+
// Adding its path (linked one for easier accessibility) will solve this problem.
156+
hosts.push(build.out.join("host"));
157+
158+
for host in hosts {
159+
let entries = match host.read_dir() {
154160
Ok(iter) => iter,
155161
Err(_) => continue,
156162
};

0 commit comments

Comments
 (0)