Skip to content

[WIP] Add an Inside Rust blog post for stage 0 std redesign #1582

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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Apr 17, 2025

Tip

There are intentionally a lot of WIP intermediate commits for review purposes, I will rebase once the content is ready.

Accompanying blog post for stage 0 std redesign: rust-lang/rust#119899

r? @onur-ozkan (and @Mark-Simulacrum)
cc @rust-lang/bootstrap (significant stage 0 bootstrap changes)

Rendered

@jieyouxu

This comment was marked as resolved.

@senekor
Copy link
Contributor

senekor commented Apr 17, 2025

Yes, the path key is required. The format has to be "YYYY/MM/DD/whatever-you-want".

I'll try to improve the templates so they produce better error messages in this case.

@senekor
Copy link
Contributor

senekor commented Apr 17, 2025

Oh if it's an inside-rust post, that should be in the path as well. So: "inside-rust/YYYY/MM/DD/whatever".

If the date of publication is not yet known, it's recommended to use the placeholder "9999/12/31" as the date, CI will prevent that from being published accidentally.

I can definitely improve docs/guidance/tooling/error msgs here.

@@ -0,0 +1,54 @@
+++
path = "inside-rust/9999/12/31/redesigning-stage-0-std"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME(jieyouxu): update this date when we're ready

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Just two suggestions in addition to my minor notes:

  1. It'd be helpful to mention the implementation PR.

  2. Consider showing the staging diagram to illustrate how things looked before and how they look now (the updated version is in the implementation PR).

@jieyouxu
Copy link
Member Author

It'd be helpful to mention the rust-lang/rust#119899.

I have no idea how I didn't include that when I even remember telling myself not to forget that lmao

@jieyouxu jieyouxu force-pushed the stage0-std-redesign branch 2 times, most recently from c8bc2d5 to 222f4fe Compare April 17, 2025 08:35
@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 17, 2025

Changes since last review (in round 2 222f4fe):

  • Added a comparison diagram showing difference before/after the redesign.
  • Addressed nits.
  • Actually link to the stage 0 redesign PR itself.


## What does this mean for a typical compiler workflow?

- If unstable library features are being dogfooded, some additional `cfg(bootstrap)` usages may now be needed in compiler sources.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would really benefit from some example(s). For example, what would this look like for e.g. a new trait solving feature that requires some core lang items?

(Aside, not the right place for this, but this effectively means that such features actually will need to a stage 2 compiler to be built to properly test them, right?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not yet addressed in (round 4).


The previous stage 0 bootstrapping sequence was a source of endless confusion for compiler, library and bootstrap contributors alike, because std had to support being built by *both* a previous beta rustc and in-tree rustc, with `cfg(bootstrap)` in std sources necessary to distinguish between them. By adjusting the stage 0 bootstrap sequence to instead use a precompiled stage 0 std instead of building the in-tree std, we hope to:

1. Simplify library development workflow to no longer need `cfg(bootstrap)`, and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also an aside and shouldn't really be discussed here, but I personally think cfg(bootstrap) in library code is likely easier to maintain and reason about than cfg(bootstrap) in compiler code.

Though, perhaps I'm wrong, in which case I think this blog post can do better at convincing me this isn't the case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be easier, but it's much more common. Instances of cfg(bootstrap) should be really rare, while in the library it's incredibly common, especially for larger refactors that were simply not done previously because it's so bad

Copy link
Member Author

@jieyouxu jieyouxu May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to include something to that effect in (round 4). Still not very convincing, but I'm not quite sure how to make it so.

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some random thoughts.

In general I feel like this post doesn't do too much to explain why the new system is a clearer/simpler mental model. And I think that does a bit of a disservice to all of the (great) explanation of what that actually means in terms of changes to building the compiler/library.

It's almost like the post frames this as an arbitrary change in what depends on what because it just so happens to make std's life simpler. When, as far as I can tell, the new system is just generally more coherent and how you would expect things to work.

E.g. generally when a rust crate is built by compiler X it also depends on the standard library built and shipped with/by X. With the previous bootstrapping setup the compiler was actually depending on some weird frankenstein std that was built by the beta compiler but wasn't shipped with it.

Similarly the inconsistency between "build the stage0 compiler" and "build the stage0 std library" was weird and has now been resolved (stage0 compiler is beta compiler, stage0 library was a weird frankenstein std but is now the beta std), but doesn't really seem to be mentioned anywhere in this post.

I think it would be a lot easier to understand what has changed if the post started with the motivation and talked about the shift in mental model to something that's generally more coherent. It's hard to fully understand what has changed without talking about how the change fits in with the wider "heres how things normally work".

Generally that's what my review comments are trying to get at I think 🤔 Small changes that would help build the right mental model for readers- but realistically it should probably be all together in one upfront paragraph for the motivation.

@jieyouxu jieyouxu force-pushed the stage0-std-redesign branch from ad5aa2b to 55c9200 Compare May 23, 2025 17:31
@jieyouxu jieyouxu force-pushed the stage0-std-redesign branch from 55c9200 to 8a3af91 Compare May 23, 2025 17:33
@jieyouxu
Copy link
Member Author

I tried to do another iteration of the blog post, the motivation bits I find is still not very convincing but idk how to make it so.

Significant changes:

  • Added a TL;DR
  • Moved motivation way earlier and
  • Dropped the exact invocation tables because I found it more noise than signal.
  • Added diagrams that I hope helps to explain the difference between current vs redesigned stage 0 bootstrap sequence

Known deficiencies:

  • Motivation/justification still needs work
  • There still isn't concrete examples as suggested, still have to think about it.

Suggestions / feedback welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants