]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #96562 - michaelwoerister:path-remapping-fixes, r=oli-obk
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Fri, 29 Apr 2022 21:54:43 +0000 (23:54 +0200)
committerGitHub <noreply@github.com>
Fri, 29 Apr 2022 21:54:43 +0000 (23:54 +0200)
Fix duplicate directory separator in --remap-path-prefix.

The compiler will currently emit duplicate directory separators when `--remap-path-prefix` has an exact match of the working directory and it is invoked with a relative path to the main source file. For example

```bash
rustc src/main.rs -Cdebuginfo=2 --remap-path-prefix="$(pwd)=abc"
```

will produce the path `abc//src/main.rs` in debuginfo. This is because `some_path.join("")` will append a directory separator to `some_path` and then LLVM does not check if the working directory already ends a directory separator before concatenating it with the relative path.


Trivial merge