Make it easier to build the standard library #394
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
This is a two part proposal. The second part depends on the first being completed, but the first part is IMO worthwhile in itself.
cd library/std && cargo +nightly build
to work (orcargo +beta build --cfg bootstrap
if that's easier).MoveThis change is no longer planned.library
to a subtree and allow building out of tree withcargo build
(usingrust-toolchain
as appropriate).Motivation
A common concern contributors bring up is that x.py is confusing to use, and that they don't understand why the standard library needs a special tool to build. See for example https://internals.rust-lang.org/t/contributing-changes-to-std/12829, https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F. Unlike the rest of the compiler, building the standard library once doesn't involve staging, just very specific versions of the rust compiler. In theory, it should be possible to build it with cargo directly.
Cloning the whole rust-lang/rust repo takes a long time and is mostly unnecessary for only working on the standard library. If you only had to clone theThis change is no longer planned.library/
folder, it would take a fraction of the time. It would also allowcargo build
to work out of the box, since the only target left out of tree is the standard library (there's no ambiguity between stages or tools).Implementation
This is mostly just me making things up currently - I'll update it as I get a more solid understanding of the problem.
compiler/
andlibrary/
so they no longer use the same global Cargo.lock and Cargo.toml. This might require rebuilding a few dependencies for the compiler, but it will be very few and they'll all be small. This is essentially Use a separate workspace for the library crates rust#76533. @ehuss you had concerns there aboutrustc-dep-of-std
that I didn't quite understand, do you mind explaining that a little more?cfg(bootstrap)
for beta.Make a newThis change is no longer planned.rust-lang/library
repository. Use subtree syncs between that andrust-lang/rust
. Since the library is still in-tree in the main repository, it will be easy to make changes to the compiler that require changing the standard library.Mentors or Reviewers
@Mark-Simulacrum for the implementation of 1; @Manishearth for the implementation of 2.
I don't think mentors make sense for forming a consensus, but pinging the relevant parties anyway: @matklad, @ehuss, @Mark-Simulacrum
Process
The main points of the Major Change Process is 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: