summary refs log tree commit diff
path: root/src/bootstrap
AgeCommit message (Collapse)AuthorLines
2025-07-10Disable docs for `compiler-builtins` and `sysroot`Josh Stone-4/+0
Bootstrap already had a manual doc filter for the `sysroot` crate, but other library crates keep themselves out of the public docs by setting `[lib] doc = false` in their manifest. This seems like a better solution to hide `compiler-builtins` docs, and removes the `sysroot` hack too. (cherry picked from commit 87e7539fcdfa45b2aab618c044f888432c5d097d)
2025-07-10Fix hang in --print=file-names in bootstrapNoratrieb-0/+6
In an interactive context, the subprocess inherited a real tty stdin, which lead it it waiting for something to happen, even though nothing happened. By explicitly passing null as stdin we make sure an empty file is passed, which achieves the desired behavior. (cherry picked from commit 3003050d473abd13d56c7e7966b971bd7443194f)
2025-06-22Rollup merge of #142868 - klensy:dc, r=oli-obkGuillaume Gomez-2/+1
remove few allow(dead_code) Few from serial/parallel compiler leftovers and few from bootstrap.
2025-06-22remove few from bootstrap tooklensy-2/+1
2025-06-22Rollup merge of #140254 - bjorn3:rustc_panic_abort_abort, r=petrochenkovJacob Pratt-12/+0
Pass -Cpanic=abort for the panic_abort crate The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case). Required for https://github.com/rust-lang/rustc_codegen_cranelift/issues/1567
2025-06-20Rollup merge of #142758 - jieyouxu:rustdoc-json-types, r=KobzolJakub Beránek-1/+1
Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed I think `rustdoc-json-types` was more recently split out, so this download-rustc logic became outdated as it wasn't tracked. This PR adds `src/rustdoc-json-types` to be tracked for difference versus upstream, so that we properly rebuild rustdoc if it has changes versus upstream. Fixes rust-lang/rust#142738. ### Local testing This is not so easy to test locally because it requires download-rustc. To test this, you need to: 1. Disable `download-rustc` inhibition from bootstrap changes versus upstream, by including `:!src/bootstrap` in https://github.com/rust-lang/rust/blob/255aa220821c05c3eac7605fce4ea1c9ab2cbdb4/src/bootstrap/src/core/config/config.rs#L67-L74. 2. Then, use a config like `profile = "tools"` which by default uses `download-rustc = "if-unchanged"`. 3. Run `./x test tests/rustdoc-json` one time, to "prime" initial build caches. 4. Change the `FORMAT_VERSION` in `src/rustdoc-json-types`, i.e. ```diff diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 1f93895ae07..72a3720c7b4 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs ``@@`` -38,7 +38,7 ``@@`` // are deliberately not in a doc comment, because they need not be in public docs.) // // Latest feature: Pretty printing of inline attributes changed -pub const FORMAT_VERSION: u32 = 48; +pub const FORMAT_VERSION: u32 = 666; ``` 5. Observe that without this patch, `rustdoc-json` tests fail because `FORMAT_VERSION` mismatch. Observe that with this patch, rustdoc gets properly rebuilt and `rustdoc-json` tests pass. cc ``@aDotInTheVoid`` r? Kobzol
2025-06-20Rollup merge of #142629 - Kobzol:bootstrap-tests-builder, r=jieyouxuJakub Beránek-19/+114
Add config builder for bootstrap tests I started writing a bunch of snapshot tests for build/check steps, and quickly realized that the current interface for defining them won't be enough, so I created a simple builder, which can scale to pretty much any kind of configuration in the future.
2025-06-20Pass -Cpanic=abort for the panic_abort cratebjorn3-12/+0
The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using panic="abort", but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case).
2025-06-20Auto merge of #142770 - tgross35:rollup-w74w39t, r=tgross35bors-0/+1
Rollup of 8 pull requests Successful merges: - rust-lang/rust#138291 (rewrite `optimize` attribute to use new attribute parsing infrastructure) - rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling) - rust-lang/rust#141990 (Implement send_signal for unix child processes) - rust-lang/rust#142668 (vec_deque/fmt/vec tests: remove static mut) - rust-lang/rust#142687 (Reduce uses of `hir_crate`.) - rust-lang/rust#142699 (Update books) - rust-lang/rust#142714 (add comment to `src/bootstrap/build.rs`) - rust-lang/rust#142753 (Update library dependencies) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-20Auto merge of #142286 - Kobzol:clippy-jemalloc, r=flip1995,blyxyasbors-2/+15
Use jemalloc for Clippy The tool macros are annoying, we should IMO just get rid of them, create separate steps for each tool and (re)use some builders in them to share the build code. r? `@ghost`
2025-06-20Add temporary directory for executing snapshot testsJakub Beránek-16/+45
2025-06-20Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changedJieyou Xu-1/+1
2025-06-19add comment to `src/bootstrap/build.rs`Deadbeef-0/+1
2025-06-19Clarify arrow in snapshot testsJakub Beránek-0/+4
2025-06-19Normalize host target in snapshot testsJakub Beránek-17/+74
2025-06-19Add `get_host_target` functionJakub Beránek-2/+7
2025-06-18Rollup merge of #142692 - Kobzol:bootstrap-small-check-cleanup, r=jieyouxuTrevor Gross-65/+16
Assorted bootstrap cleanups (step 3) I keep failing to unwrap the gordic knot of the logic of checking tools in bootstrap :confounded: So in the meantime I at least want to upstream some cleanups I did along the way. Since some time ago, we have separate steps for Clippy, so it shouldn't ever happen again that the check steps would be invoked with `builder.kind == Clippy`. r? `@jieyouxu`
2025-06-18Remove useless conditions about ClippyJakub Beránek-42/+11
We should always just use `Kind::Check` for the check steps, as Clippy now has an entirely separate set of steps.
2025-06-18Remove `override_build_kind`Jakub Beránek-23/+5
It doesn't seem to be needed, we can just use `Kind::Check` explicitly.
2025-06-18Rollup merge of #142672 - Kobzol:bootstrap-tool-clarification, r=jieyouxuJakub Beránek-6/+17
Clarify bootstrap tools description The existence of `stage0-bootstrap-tools` suggests the possiblity of `stage1/N-bootstrap-tools`, but that's not really a thing. Also it doesn't fit the new bootstrap model, where `stageN` essentially means that it was built with a `stageN-1` compiler (except for std). r? ``@jieyouxu``
2025-06-18Rollup merge of #142627 - Kobzol:bootstrap-metadata, r=jieyouxuJakub Beránek-45/+83
Add `StepMetadata` to describe steps This is used to replace the previous downcasting of executed steps, which wasn't very scalable. In addition to tests, we could also use the metadata e.g. for tracing. r? ```@jieyouxu```
2025-06-18Rollup merge of #142624 - Kobzol:bootstrap-fix-host, r=jieyouxuJakub Beránek-58/+99
Actually take `--build` into account in bootstrap I went back 20 *stable* versions of Rust and I couldn't find this flag actually being used. Despite some of our CI workflows actually set this flag (!). I added destructuring of the flags to make sure that this doesn't happen again. It found one more duplicated CLI flag. r? ```@jieyouxu```
2025-06-18Rollup merge of #142591 - Shourya742:2025-06-14-add-spawn-execution-api, ↵Jakub Beránek-118/+176
r=Kobzol Add spawn APIs for BootstrapCommand to support deferred command execution This PR adds new deferred command support in the ExecutionContext and provides APIs to spawn commands and wait for their completion. This structure enables moving away from the start_process helper functions towards a more unified and reusable command execution flow. r? ````@Kobzol````
2025-06-18Clarify bootstrap tool description and change its directory to simply ↵Jakub Beránek-6/+17
`bootstrap-tools`
2025-06-18Remove unused bootstrap flagJakub Beránek-4/+1
2025-06-18Destructure bootstrap flags to make sure that none of them are unusedJakub Beránek-55/+97
2025-06-17Rollup merge of #142605 - ZuseZ4:autodiff-check-builds2, r=oli-obkJacob Pratt-13/+14
Don't unwrap in enzyme builds in case of missing llvm-config r? `@onur-ozkan` For some reason x.py was now panicking in this location, so I also removed the unwrap here. part 2 of https://github.com/rust-lang/rust/pull/140000, there shouldn't be other locations where we check for llvm-config.
2025-06-17allow spawn to behave according to failure behaviorbit-aloo-36/+52
2025-06-17change to executed atbit-aloo-11/+13
2025-06-17add run_always to recently migrated start_process commandbit-aloo-1/+4
2025-06-17move execution context out of deferred command, add as_ref implementation ↵bit-aloo-26/+20
and update wait_for_output usage
2025-06-17explain reasoning behind spawn APIbit-aloo-0/+1
2025-06-17add created at to command executionbit-aloo-4/+8
2025-06-17remove new method from command executionbit-aloo-12/+14
2025-06-17remove start_porcess helper methodbit-aloo-29/+0
2025-06-17move from start process to new start and wait for output api'sbit-aloo-18/+23
2025-06-17add start methods in execbit-aloo-3/+18
2025-06-17add deferred command in execution context and update run methodbit-aloo-46/+91
2025-06-17Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obkbors-2/+2
Sized Hierarchy: Part I This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library, `MetaSized` and `PointeeSized`. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract. These traits are unstable (as is their constness), so users cannot refer to them without opting-in to `feature(sized_hierarchy)`. These traits are not behind `cfg`s as this would make implementation unfeasible, there would simply be too many `cfg`s required to add the necessary bounds everywhere. So, like `Sized`, these traits are automatically implemented by the compiler. RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows: - `?Sized` is rewritten as `MetaSized` - `MetaSized` is added as a default supertrait for all traits w/out an explicit sizedness supertrait already. There are no edition migrations implemented in this, as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing `?Sized` even if the compiler sees `MetaSized`) unless the `sized_hierarchy` feature is enabled. Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax `Deref::Target` (this will be investigated separately). It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output. **Notes:** - Any commits starting with "upstream:" can be ignored, as these correspond to other upstream PRs that this is based on which have yet to be merged. - This best reviewed commit-by-commit. I've attempted to make the implementation easy to follow and keep similar changes and test output updates together. - Each commit has a short description describing its purpose. - This patch is large but it's primarily in the test suite. - I've worked on the performance of this patch and a few optimisations are implemented so that the performance impact is neutral-to-minor. - `PointeeSized` is a different name from the RFC just to make it more obvious that it is different from `std::ptr::Pointee` but all the names are yet to be bikeshed anyway. - `@nikomatsakis` has confirmed [that this can proceed as an experiment from the t-lang side](https://rust-lang.zulipchat.com/#narrow/channel/435869-project-goals/topic/SVE.20and.20SME.20on.20AArch64.20.28goals.23270.29/near/506196491) - FCP in https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485 Fixes rust-lang/rust#79409. r? `@ghost` (I'll discuss this with relevant teams to find a reviewer)
2025-06-17Add `StepMetadata` to describe stepsJakub Beránek-45/+83
This is used to replace the previous downcasting of executed steps, which wasn't very scalable. In addition to tests, we could also use the metadata e.g. for tracing.
2025-06-17Actually take `--build` into account in bootstrapJakub Beránek-1/+3
I went back 20 *stable* versions of Rust and I couldn't find this flag actually being used. Despite some of our CI workflows actually set this flag (!).
2025-06-16don't unwrap in enzyme builds in case of missing llvm-configManuel Drehwald-13/+14
2025-06-16bootstrap: address lint failuresDavid Wood-2/+2
Unexpected Clippy lint triggering is fixed in upcoming commits but is necessary for `cfg(bootstrap)`.
2025-06-16Rollup merge of #142431 - Kobzol:bootstrap-snapshot-tests, r=jieyouxuJakub Beránek-20/+158
Add initial version of snapshot tests to bootstrap When making any changes to bootstrap (steps), it is very difficult to realize how does it affect various common bootstrap commands, and if everything still works as we expect it to. We are far away from having actual end-to-end tests, but what we could at least do is have a way of testing what steps does bootstrap execute in dry run mode. Now, we already have something like this in `src/bootstrap/src/core/builder/tests.rs`, however that is quite limited, because it only checks executed steps for a specific impl of `Step` and it does not consider step order. Recently, when working on what I thought was one of the simplest possible step untanglings in bootstrap (https://github.com/rust-lang/rust/pull/142357), I ran into errors in tests that were quite hard to debug. Partly also because the current staging test diffs are multiline and use `Debug` output, so it's quite difficult for me to make sense of them. In this PR, I introduce `insta`, which allows writing snapshot tests in a very simple way. With it, I want to allow writing tests that will clearly show us what is going on during bootstrap execution, and then write golden tests for `build/check/test` stage `0/1/2` for compiler/std/tools etc., to make sure that we don't regress something, and also to help with [#t-infra/bootstrap > Proposal to cleanup stages and steps after the redesign](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Proposal.20to.20cleanup.20stages.20and.20steps.20after.20the.20redesign/with/523488806), to help avoid a situation where we would (again) have to make a flurry of staging changes because of unexpected consequences. In the snapshot tests, we currently render the build of rustc, std and LLVM. Currently I render the executed steps using downcasting, which is not super pretty, but it allows us to make the test rendering localized in one place, and it's IMO enough for now. I implemented only a single test using the new machinery. Maybe if you take a look at it, you will understand why :laughing: Bootstrap currently does some peculiar things, such as running a stage 0 std step (even though stage 0 std no longer exists) and running the Rustc stage 0 -> 1 step twice, once with a single crates, once with all rustc crates. So I think that even with this single step, there will be a bunch of things to fix in the near future... The way we currently prepare the Config test fixtures is far from ideal, this is something I think ``@Shourya742`` could work on as a part of their GSoC project (remove as much command execution from Config construction as possible, actually run bootstrap on a temporary directory instead of running it on the rustc checkout, create a Builder-like API for creating the Config test fixtures). r? ``@jieyouxu``
2025-06-16Rollup merge of #142416 - Kobzol:bootstrap-cleanup-2, r=jieyouxuJakub Beránek-90/+87
Assorted bootstrap cleanups (step 2) Very small improvements designed towards making bootstrap tests less hacky/special, and towards making it possible to run bootstrap tests in parallel. Best reviewed commit by commit. r? ``@jieyouxu``
2025-06-14remove check_run function from helpersbit-aloo-27/+9
2025-06-14remove check_run method from configbit-aloo-13/+2
2025-06-14replace all instances of check_run in download with execution contextbit-aloo-2/+2
2025-06-14replace all instances of check_run in config with execution contextbit-aloo-17/+15
2025-06-13Rollup merge of #142459 - Shourya742:2025-06-11-remove-output-helper, r=KobzolJubilee-36/+29
Remove output helper bootstrap This PR removes output utility helper method. r? `@Kobzol`