SIGN IN SIGN UP
rust-lang / rust UNCLAIMED

Empowering everyone to build reliable and efficient software.

0 0 65 Rust

Auto merge of #115872 - ferrocene:pa-remap-cargo-home, r=clubby789

Remap Cargo dependencies to /rust/deps

:warning: **This doesn't affect user-compiled programs, it only affects building the Rust compiler itself.** :warning:

Right now, `rust.remap-debuginfo = true` doesn't completely remap all paths: while LLVM and rustc sources are properly remapped (respectively to `/rust/llvm` and `/rust/$commit`), Cargo dependencies still use absolute paths from the Cargo home.

This never affected builds from CI much, because `CARGO_HOME=/cargo` in CI, so users see paths like this included in the precompiled binaries and libraries:

```
/cargo/registry/src/index.crates.io-6f17d22bba15001f/gimli-0.26.2/src/read/line.rs
```

Builds outside CI don't have remapping though, and it's confusing that the config flag doesn't fully do what it advertises.

This PR fixes it by adding remapping for dependencies too. *All registries's* source directory are remapped to `/rust/deps`, to account for multiple registries being able to contain crates.io crates (sparse index vs git, and source replacement mirrors). This results in paths like this being included:

```
/rust/deps/gimli-0.26.2/src/read/line.rs
```
B
bors committed
278eaf509d0871c5aa09b6b5fec9dc72226578e2