Description
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:
set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust
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:
RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \(\w*\)/\1/p')"
So this MCP proposes adding a way to set up the path mapping shown above. There are a couple of alternatives, for example:
- a single
--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
). - two flags, one for each component
- two flags, one for the commit hash and one for the
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:
- File an issue describing the proposal.
- A compiler team member or contributor who is knowledgeable in the area can second by writing
@rustbot second
.- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
-C flag
, then full team check-off is required. - Compiler team members can initiate a check-off via
@rfcbot fcp merge
on either the MCP or the PR.
- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
- Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.
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.