diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2024-12-23 02:07:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-23 02:07:31 -0500 |
| commit | fde85a8e5f029ae8b064faec6af5ca8a9501006d (patch) | |
| tree | 492be018a414e511b3825d234cbf04eff75dcf85 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 3acf9c93a46f7d2e602ec44a7c296f3539ac55be (diff) | |
| parent | 4d3bf1f5eed1247d773096e35e0cd471a0692e70 (diff) | |
| download | rust-fde85a8e5f029ae8b064faec6af5ca8a9501006d.tar.gz rust-fde85a8e5f029ae8b064faec6af5ca8a9501006d.zip | |
Rollup merge of #134659 - jieyouxu:recursive-remove, r=ChrisDenton
test-infra: improve compiletest and run-make-support symlink handling
I was trying to implement #134656 to port `tests/run-make/incr-add-rust-src-component.rs`, but found some blockers related to symlink handling, so in this PR I tried to resolve them by improving symlink handling in compiletest and run-make-support (particularly for native windows msvc environment).
Key changes:
- I needed to copy symlinks (duplicate a symlink pointing to the same file), so I pulled out the copy symlink logic and re-exposed it as `run_make_support::rfs::copy_symlink`. This helper correctly accounts for the Windows symlink-to-file vs symlink-to-dir distinction (hereafter "Windows symlinks") when copying symlinks.
- `recursive_remove`:
- I needed a way to remove symlinks themselves (no symlink traversal). `std::fs::remove_dir_all` handles them, but only if the root path is a directory. So I wrapped `std::fs::remove_dir_all` to also handle when the root path is a non-directory entity (e.g. file or symlink). Again, this properly accounts for Windows symlinks.
- I wanted to use this for both compiletest and run-make-support, so I put the implementation and accompanying tests in `build_helper`.
- In this sense, it's a reland of #129302 with proper test coverage.
- It's a thin wrapper around `std::fs::remove_dir_all` (`remove_dir_all` correctly handles read-only entries on Windows). The helper has additional permission-setting logic for when the root path is a non-dir entry on Windows to handle read-only non-dir entry.
Fixes #126334.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
