-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Remap compiler vs non-compiler sources differently (bootstrap side) #141751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
We'll also need in the compiler a different compile-time environment variable, like is currently done for Be aware that both environment variables need to be set when compiling the compiler. |
rustbot has assigned @albertlarsan68. Use |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
- Map compiler sources (corresponding to `rustc-dev` dist component) with `/rustc-dev/{hash}`. - Map non-compiler sources (corresponding to `rust-src` dist component or other non-compiler sources) with `/rustc/{hash}`. This allows the compiler to have the possibility of opportunistically reverse the mapping. This is because - `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` (Notice the `src` vs `rustc-src` difference.)
@rustbot ready |
The changes looks good to me. Thanks you. |
See #t-compiler/help > Span pointing to wrong file location (`rustc-dev` component).
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, therustc-dev
dist component (compiler sources) andrust-src
dist component (library sources) unpacks differently:rust-src
unpacks sources to a path like$sysroot/lib/rustlib/src/rust
, whereasrustc-dev
unpacks sources to a path like$sysroot/lib/rustlib/rustc-src/rust
1,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:
rustc-dev
dist component) with/rustc-dev/{hash}
(this isRemapScheme::Compiler
), andrust-src
dist component or other non-compiler sources) with/rustc/{hash}
(this isRemapScheme::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 forrustc-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.Footnotes
(Notice the
src
vsrustc-src
difference.) ↩