about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-09 10:20:51 +0200
committerGitHub <noreply@github.com>2025-06-09 10:20:51 +0200
commit45cf4fb8d7fb958334fc6213a45f8c8bb04e1096 (patch)
tree9b86e9be06c9fe5135f896d624ca710ede52a6ff /compiler/rustc_codegen_llvm/src
parent334ba812755b974ecc46713fcdd38836b6182746 (diff)
parent8976a6ee07fd983cda1463fd299a4e2adc16ec4d (diff)
downloadrust-45cf4fb8d7fb958334fc6213a45f8c8bb04e1096.tar.gz
rust-45cf4fb8d7fb958334fc6213a45f8c8bb04e1096.zip
Rollup merge of #141751 - jieyouxu:remap, r=Kobzol
Remap compiler vs non-compiler sources differently (bootstrap side)

See [#t-compiler/help > Span pointing to wrong file location (&#96;rustc-dev&#96; component)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Span.20pointing.20to.20wrong.20file.20location.20.28.60rustc-dev.60.20component.29/with/521087083).

The path remapping and unremapping for compiler sources (distributed via `rustc-dev` dist component) is broken because bootstrap currently remaps all sources unconditionally (if remapping is enabled) to the `/rustc/{hash}` form. However, the `rustc-dev` dist component (compiler sources) and `rust-src` dist component (library sources) unpacks differently:

- `rust-src` unpacks sources to a path like `$sysroot/lib/rustlib/src/rust`, whereas
- `rustc-dev` unpacks sources to a path like `$sysroot/lib/rustlib/rustc-src/rust`[^note],

meaning that the compiler need to unremap them differently. But the same remapping means that the compiler has no way to distinguish between compiler and non-compiler (esp. standard library) sources. To remedy this, this PR adopts the approach of:

- remapping compiler sources (corresponding to `rustc-dev` dist component) with `/rustc-dev/{hash}` (this is `RemapScheme::Compiler`), and
- remapping non-compiler sources (corresponding to `rust-src` dist component or other non-compiler sources) with `/rustc/{hash}` (this is `RemapScheme::NonCompiler`).

A different remapping allows the compiler to reverse the remapping differently.

This PR implements the bootstrap side. A follow-up compiler-side change is needed to implement the unremapping change to address the reported issue completely.

This PR introduces another env var `CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR` that is made available to the compiler when building compiler sources to know what the remap scheme for `rustc-dev` (`RemapScheme::Compiler`) is. Compiler sources are built with the compiler remapping scheme.

As far as I know, this change should not introduce new regressions, because the compiler source unremapping (through `rustc-dev`) is already broken.

[^note]: (Notice the `src` vs `rustc-src` difference.)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions