Add a --print=unmap-path-prefixes
flag
#612
Labels
major-change
A proposal to make a major change to rustc
major-change-accepted
A major change proposal that was accepted
T-compiler
Add this label so rfcbot knows to poll the compiler team
Proposal
To help with reproducible builds, the standard library is built under a path like
/rustc/b955c8271da80a1af8a1d54c4e1bbdaf51b032e9/library
. However, debuggers will not be able to locate the source code, leading to a poor user experience, as shown in rust-lang/rust#62945.This was fixed in rust-lang/rust#109527 for GDB and rustup installs, but it's fragile because it still makes some assumptions about the directory structure:
Specifically, this is unlikely to work for Linux distro packagers. In addition, getting the commit hash is not that easy either, and requires an external tool to be available:
So this MCP proposes adding a way to set up the path mapping shown above. There are a couple of alternatives, for example:
--print
flag to print both components (remapped and real path), e.g./rustc/b955c8271da80a1af8a1d54c4e1bbdaf51b032e9:/home/lnicola/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust
. This has the disadvantage of requiring the user to split by a character like:
or\x1f
(like withCARGO_ENCODED_RUSTCFLAGS
), but can support multiple mapped paths if necessary (from_1\x1fto_1\x1ffrom_2\x1fto_2
).rust-src
path, the latter potentially relative to the sysroot. This bakes in the assumption that the mapped path will always be/rustc/$RUSTC_COMMIT_HASH
.Which of these to implement is an open question. I'd personally pick the second or first option above.
Mentors or Reviewers
@cuviper as the Fedora Rust packager
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: