Repository: rust
Issue: Tracking Issue for removing python as the main bootstrap entry point
Labels: T-bootstrap,T-infra,C-tracking-issue

<!--
NOTE: For library features, please use the "Library Tracking Issue" template instead.

Thank you for creating a tracking issue! 📜 Tracking issues are for tracking a
feature from implementation to stabilisation. Make sure to include the relevant
RFC for the feature if it has one. Otherwise provide a short summary of the
feature and link any relevant PRs or issues, and remove any sections that are
not relevant to the feature.

Remember to add team labels to the tracking issue.
For a language team feature, this would e.g., be `T-lang`.
Such a feature should also be labeled with e.g., `F-my_feature`.
This label is used to associate issues (e.g., bugs and design questions) to the feature.
-->

This is a tracking issue for removing the requirement on python for bootstrapping the compiler.
Note that bootstrap.py is never going to be removed altogether, since distros still need to get a bootstrap compiler from somewhere; this issue is about contributors who already have a rust toolchain installed.

The living document for this tracking issue is https://hackmd.io/j-XXBeYERuajJknd6zErPA?both.

In particular, this subsumes https://github.com/rust-lang/rust/issues/71818.

### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

### Steps
<!--
Include each step required to complete the feature. Typically this is a PR
implementing a feature, followed by a PR that stabilises the feature. However
for larger features an implementation could be broken up into multiple PRs.
-->

- [x] Implement `cargo run -p bootstrap`
- [x] Move `download-llvm` to rustbuild: https://github.com/rust-lang/rust/pull/95170. This can just shell out to `curl`, the same way bootstrap.py does currently.
- [x] Move `download-rustc` to rustbuild: https://github.com/rust-lang/rust/pull/96687
- [x] Download rustfmt in rustbuild, not bootstrap.py: https://github.com/rust-lang/rust/issues/95136
- [ ] Make bootstrap downloadable from CI, like llvm: https://github.com/rust-lang/rust/pull/98483, https://github.com/rust-lang/rust/issues/99989
- [ ] Add `x.sh` and `x.ps1` entrypoints which don't go through bootstrap.py and download bootstrap from CI
  - [x] Add the entrypoints https://github.com/rust-lang/rust/pull/99992
  - [ ] Add a new `bootstrap-shim` binary that *only* loads the config info and downloads bootstrap from CI
  - [ ] Package that shim on each nightly
  - [ ] Call that shim from the shell scripts
  - [ ] Update documentation in the dev-guide to suggest `x.sh` / `x.ps1`
  - [x] Change `src/tools/x` to use the new entrypoints: https://github.com/rust-lang/rust/pull/105844
- [x] Manage submodules fully in rustbuild instead of bootstrap.py: https://github.com/rust-lang/rust/pull/97513
  - [x] Remove rustbuild from the workspace so it doesn't break when the submodules aren't cloned
- [x] Move build locking to rustbuild: https://github.com/rust-lang/rust/pull/98373. See https://github.com/rust-lang/rust/pull/88310#discussion_r695302393 for some discussion about the current state of file locking in Rust.


If you'd like to help with this feature, feel free to join the Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members/topic/Help.20with.20RRIR.20bootstrap.20entrypoint.20.2394829

### Unresolved Questions
<!--
Include any open questions that need to be answered before the feature can be
stabilised.
-->

- Should we move the "Build completed successfully" output to rustbuild? If we keep it only in bootstrap.py, the new entry point will have less info; if we move it to bootstrap the info will be incomplete even for python users because it won't include the time to build rustbuild.

### Implementation history

<!--
Include a list of all the PRs that were involved in implementing the feature.
-->

- https://github.com/rust-lang/rust/pull/76544
- Implement `cargo run -p bootstrap`: https://github.com/rust-lang/rust/pull/92260
- Align rustbuild's submodule behavior with x.py's: https://github.com/rust-lang/rust/pull/93722
- https://github.com/rust-lang/rust/pull/94796
- https://github.com/rust-lang/rust/pull/94828
- https://github.com/rust-lang/rust/pull/94806
- https://github.com/rust-lang/rust/pull/94830
- https://github.com/rust-lang/rust/pull/95164
- https://github.com/rust-lang/rust/pull/95170
- https://github.com/rust-lang/rust/pull/95253
- https://github.com/rust-lang/rust/pull/95254
- https://github.com/rust-lang/rust/pull/96687
- https://github.com/rust-lang/rust/pull/97507
- https://github.com/rust-lang/rust/pull/97513
- https://github.com/rust-lang/rust/pull/98483
- https://github.com/rust-lang/rust/pull/98373
- https://github.com/rust-lang/rust/pull/104188
- https://github.com/rust-lang/rust/pull/105844

@rustbot label: +A-rustbuild +T-infra
cc @Mark-Simulacrum - I thought I'd write my plan down so you're not seeing PRs come in out of the blue.