Skip to content

Refactor codegen backends in bootstrap #144787

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b6f12d7
Rename extended rustc tool macros
Kobzol Jun 18, 2025
65c3597
Add metadata to `Cargo` and `RustAnalyzer` tools
Kobzol Jul 22, 2025
57a6c93
Cleanup `ensure_if_default` to not require `Option` output
Kobzol Jul 22, 2025
8fed3fb
Add step metadata to `RustAnalyzerProcMacroSrv`
Kobzol Jul 22, 2025
2f3bfff
Rename `Builder::rustdoc` to `Builder::rustdoc_for_compiler`
Kobzol Jul 22, 2025
6d562b2
Implement `RustcPrivateCompilers` to unify building of `rustc_private…
Kobzol Jul 22, 2025
b944144
Add step metadata and a few tests for `Doc` steps
Kobzol Jul 22, 2025
2c7581f
Refactor `Rustdoc`
Kobzol Jul 22, 2025
91d40d2
Fix `ToolRustc` build with `download-rustc`
Kobzol Jul 22, 2025
7a2c4d3
Add step metadata and a simple test for codegen backends
Kobzol Jul 22, 2025
06855be
Port codegen backends to `RustcPrivateCompilers`
Kobzol Jul 22, 2025
c3da07b
Rename `link_compiler` to `target_compiler`
Kobzol Jul 22, 2025
0ff8ff3
Appease Clippy
Kobzol Jul 22, 2025
316b5d3
Add basic Cargo snapshot test
Kobzol Jul 21, 2025
21d7a54
Make `Cargo` a `ToolTarget` tool
Kobzol Jul 21, 2025
021f2ff
Update `CargoTest`
Kobzol Jul 21, 2025
3e6aa81
Add snapshot tests for `test cargo` and update Cargo snapshot tests
Kobzol Jul 21, 2025
528e7dc
Make build compiler explicit in `dist::Cargo`
Kobzol Jul 28, 2025
1d1efed
Fix `x test cargo`
Kobzol Jul 29, 2025
47da014
Make `x test cargo` stage N test rustc stage N
Kobzol Jul 31, 2025
c46f42d
Clarify comments on Cargo (self-)test steps
Kobzol Aug 1, 2025
d007145
Split CodegenBackend step into two and handle stamp sysroot copy expl…
Kobzol Aug 1, 2025
669a9e0
Refactor `dist::CraneliftCodegenBackend`
Kobzol Aug 1, 2025
588f96f
Clarify the behavior of `rust.codegen-backends`
Kobzol Aug 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,19 @@
# result (broken, compiling, testing) into this JSON file.
#rust.save-toolstates = <none> (path)

# This is an array of the codegen backends that will be compiled for the rustc
# that's being compiled. The default is to only build the LLVM codegen backend,
# and currently the only standard options supported are `"llvm"`, `"cranelift"`
# and `"gcc"`. The first backend in this list will be used as default by rustc
# when no explicit backend is specified.
# This array serves three distinct purposes:
# - Backends in this list will be automatically compiled and included in the sysroot of each
# rustc compiled by bootstrap.
# - The first backend in this list will be configured as the **default codegen backend** by each
# rustc compiled by bootstrap. In other words, if the first backend is e.g. cranelift, then when
# we build a stage 1 rustc, it will by default compile Rust programs using the Cranelift backend.
# This also means that stage 2 rustc would get built by the Cranelift backend.
# - Running `x dist` (without additional arguments, or with `--include-default-paths`) will produce
# a dist component/tarball for the Cranelift backend if it is included in this array.
#
# Note that the LLVM codegen backend is special and will always be built and distributed.
#
# Currently, the only standard options supported here are `"llvm"`, `"cranelift"` and `"gcc"`.
Copy link
Member

Choose a reason for hiding this comment

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

General comment: this is exactly the behaviour I wanted, thanks so much for implementing it!

Copy link
Member Author

@Kobzol Kobzol Aug 4, 2025

Choose a reason for hiding this comment

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

This is the existing behavior, I didn't change it in this PR, just documented it and refactored it :D The only change is that it is now possible to build a backend even if it isn't in the array in the config file.

#rust.codegen-backends = ["llvm"]

# Indicates whether LLD will be compiled and made available in the sysroot for rustc to execute, and
Expand Down
Loading
Loading