bootstrap: fix clean's remove_dir_all implementation by jieyouxu · Pull Request #129187 · rust-lang/rust (original) (raw)

It turns out bootstrap's clean.rs's hand-rolled rm_rf (which probably comes before std::fs::remove_dir_all was stable) is very broken on native Windows around both read-only files/directories and especially symbolic links. So instead of rolling our own, just use std::fs::remove_dir_all.

This is a related to compiletest's own rm_rf implementation #129155 which happens to be also buggy, which in turn is a blocker for the rmake.rs test port #128562 that heavily exercises symlinks (I was reviewing #128562 and testing it on native Windows which is how I found out).

Fixes #112544 (because now we handle Windows symlinks properly).

try-job: x86_64-msvc
try-job: i686-mingw
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
try-job: aarch64-gnu