about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2021-10-04 21:12:35 -0700
committerGitHub <noreply@github.com>2021-10-04 21:12:35 -0700
commit7aa9ce55b91726d92770107bfaf5961163cd9388 (patch)
treef4a371d61cb2d1ddbc1ce467ef578f99c232313a /compiler/rustc_codegen_llvm/src
parent234fa908788f098b12c2f54181b6133f355fa07e (diff)
parentfa4072f7d32221adf5edc8d57c9cb8fef3ddc96e (diff)
downloadrust-7aa9ce55b91726d92770107bfaf5961163cd9388.tar.gz
rust-7aa9ce55b91726d92770107bfaf5961163cd9388.zip
Rollup merge of #89270 - seanyoung:join_fold, r=m-ou-se
path.push() should work as expected on windows verbatim paths

On Windows, std::fs::canonicalize() returns an so-called UNC path.  UNC paths differ with regular paths because:

- This type of path can much longer than a non-UNC path (32k vs 260 characters).
- The prefix for a UNC path is ``Component::Prefix(Prefix::DiskVerbatim(..)))``
- No `/` is allowed
- No `.` is allowed
- No `..` is allowed

Rust has poor handling of such paths. If you join a UNC path with a path with any of the above, then this will not work.

I've implemented a new method `fn join_fold()` which joins paths and also removes any `.` and `..` from it, and replaces `/` with `\` on Windows. Using this function it is possible to use UNC paths without issue. In addition, this function is useful on Linux too; paths can be appended without having to call `canonicalize()` to remove the `.` and `..`.

This PR needs test cases, which can I add. I hope this will a start of a discussion.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions