Commit graph

7327 commits

Author SHA1 Message Date
Jakub Beránek
ccacb4643d
Rollup merge of #142672 - Kobzol:bootstrap-tool-clarification, r=jieyouxu
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-18 18:06:54 +02:00
Jakub Beránek
7cd4b5c828
Rollup merge of #142627 - Kobzol:bootstrap-metadata, r=jieyouxu
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-18 18:06:52 +02:00
Jakub Beránek
7b53cc06a0
Rollup merge of #142624 - Kobzol:bootstrap-fix-host, r=jieyouxu
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-18 18:06:52 +02:00
Jakub Beránek
ec295ad59c
Rollup merge of #142591 - Shourya742:2025-06-14-add-spawn-execution-api, 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-18 18:06:50 +02:00
Jakub Beránek
6be97a0b0c
Clarify bootstrap tool description and change its directory to simply bootstrap-tools 2025-06-18 15:03:56 +02:00
Jakub Beránek
aeea2e5c61
Remove unused bootstrap flag 2025-06-18 09:38:28 +02:00
Jakub Beránek
c44ea8454d
Destructure bootstrap flags to make sure that none of them are unused 2025-06-18 09:38:27 +02:00
Jacob Pratt
504b1a12f3
Rollup merge of #142605 - ZuseZ4:autodiff-check-builds2, r=oli-obk
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-17 23:19:37 +02:00
bit-aloo
05122808a3
allow spawn to behave according to failure behavior 2025-06-17 23:09:44 +05:30
bit-aloo
186f588772
change to executed at 2025-06-17 21:10:55 +05:30
bit-aloo
55e2c2681e
add run_always to recently migrated start_process command 2025-06-17 20:49:20 +05:30
bit-aloo
05e1ae7bd4
move execution context out of deferred command, add as_ref implementation and update wait_for_output usage 2025-06-17 20:49:20 +05:30
bit-aloo
dca9fe0d94
explain reasoning behind spawn API 2025-06-17 20:49:20 +05:30
bit-aloo
2270572cb4
add created at to command execution 2025-06-17 20:49:19 +05:30
bit-aloo
0c60856ed1
remove new method from command execution 2025-06-17 20:49:19 +05:30
bit-aloo
b16ba4d3ee
remove start_porcess helper method 2025-06-17 20:49:19 +05:30
bit-aloo
2e4f2d2f3b
move from start process to new start and wait for output api's 2025-06-17 20:49:19 +05:30
bit-aloo
16bc870ee2
add start methods in exec 2025-06-17 20:49:19 +05:30
bit-aloo
7889332342
add deferred command in execution context and update run method 2025-06-17 20:49:19 +05:30
bors
86d0aef804 Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
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-17 15:08:50 +00:00
Jakub Beránek
4ed60bb9e4
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.
2025-06-17 16:05:33 +02:00
Jakub Beránek
e19ec445e8
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 (!).
2025-06-17 15:13:30 +02:00
Manuel Drehwald
f1fea6c950 don't unwrap in enzyme builds in case of missing llvm-config 2025-06-16 20:04:57 -07:00
David Wood
126c5e936a
bootstrap: address lint failures
Unexpected Clippy lint triggering is fixed in upcoming commits but
is necessary for `cfg(bootstrap)`.
2025-06-16 23:04:37 +00:00
Jakub Beránek
e036a564e4
Rollup merge of #142431 - Kobzol:bootstrap-snapshot-tests, r=jieyouxu
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 😆 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-16 14:31:12 +02:00
Jakub Beránek
ac8a48dad2
Rollup merge of #142416 - Kobzol:bootstrap-cleanup-2, r=jieyouxu
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-16 14:31:11 +02:00
bit-aloo
c9eeeb4b5f
remove check_run function from helpers 2025-06-14 18:23:35 +05:30
bit-aloo
b5db059b83
remove check_run method from config 2025-06-14 17:10:44 +05:30
bit-aloo
c67f7ae27f
replace all instances of check_run in download with execution context 2025-06-14 17:10:07 +05:30
bit-aloo
e11e640013
replace all instances of check_run in config with execution context 2025-06-14 17:09:25 +05:30
Jubilee
8b22fcbd51
Rollup merge of #142459 - Shourya742:2025-06-11-remove-output-helper, r=Kobzol
Remove output helper bootstrap

This PR removes output utility helper method.

r? `@Kobzol`
2025-06-13 20:59:21 -07:00
bit-aloo
2f7cc5a285
remove output from helpers 2025-06-13 20:03:29 +05:30
bit-aloo
66beaa6e5d
replace output usage in bootstrap/lib.rs with new execution context 2025-06-13 20:03:24 +05:30
bit-aloo
da0cceebf0
replace output usage in sanity with new execution context 2025-06-13 18:29:48 +05:30
Matthias Krüger
4838c0085c
Rollup merge of #142379 - Stypox:bootstrap-tool-config, r=Kobzol
Add bootstrap option to compile a tool with features

Add an option to specify which features to build a tool with, e.g. it will be useful to build Miri with tracing enabled:
```toml
tool-config.miri.features = ["tracing"]
```

See [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Passing.20--features.20to.20Miri.20build.20using.20.2E.2Fx.2Epy/with/523564773) for the options considered. If the final decision will be different than what I wrote now, I will update the code as needed. The reason why the option is `tool-config.miri.features` instead of something like `tool-features.miri` is to possibly allow adding more tool-specific configurations in the future.

I didn't do any validation of the keys of the `tool-config` hashmap, since I saw that no validation is done on the `tools` hashset either.

I don't like much the fact that features can be chosen by various places of the codebase: `Step`s can have some fixed `extra_features`, `prepare_tool_cargo` will add features depending on some bootstrapping options, and the newly added option can also contribute features to tools. However I think it is out of scope of this PR to try to refactor all of that (if it even is refactorable), so I left a comment in the codebase explaining all of the sources of features I could find.
2025-06-13 05:16:59 +02:00
Jakub Beránek
6feb9b792c
Add lightweight snapshot testing for bootstrap tests 2025-06-12 19:42:03 +02:00
Jakub Beránek
983fe4f265
Simplify configure_with_args 2025-06-12 19:38:25 +02:00
Jakub Beránek
a71b463d2b
Move submodule path cache from parse_gitmodules to Builder
It would not be correct if multiple values of `target_dir` were ever passed to the function in the same process.
2025-06-12 15:48:50 +02:00
Jakub Beránek
dbe15e3e94
Remove environment variable modification in test_default_compiler_wasi 2025-06-12 15:48:50 +02:00
Jakub Beránek
85401882d2
Remove RefCell from cc/cxx/ar/ranlib
It wasn't really needed there.
2025-06-12 15:48:50 +02:00
Jakub Beránek
2591571263
Stop using Config for tempdir-as-a-service in build_stamp tests 2025-06-12 15:48:50 +02:00
Jakub Beránek
40c2ca9641
Move shared_helpers test to a dedicated module 2025-06-12 15:48:50 +02:00
Jakub Beránek
5b50e0ba54
Add support for snapshot tests with insta 2025-06-12 14:27:29 +02:00
Stypox
17f69bfda0
Rename tool-config to tool and add docs 2025-06-12 13:58:38 +02:00
Matthias Krüger
bb9dda1272
Rollup merge of #142303 - Kobzol:bootstrap-cleanup-1, r=jieyouxu
Assorted bootstrap cleanups (step 1)

Now that the stage0 redesign has landed, we can finally start cleaning up many things in bootstrap, and lord knows it deserves it! I plan to send many PRs once I figure out an incremental way forward, this is the first one of them. It doesn't actually change anything, just renames stuff and adds more documentation, but the rename is bitrotty, so I wanted to push the PR eagerly.

r? `@jieyouxu`
2025-06-12 03:14:53 +02:00
Matthias Krüger
c97dca6989
Rollup merge of #142374 - Kobzol:fix-newline, r=tmiasko
Fix missing newline trim in bootstrap

Fixes [this comment](https://github.com/rust-lang/rust/pull/141909/files#r2140632918).

Fixes: https://github.com/rust-lang/rust/issues/142350
2025-06-11 22:58:30 +02:00
Matthias Krüger
e80be0bcba
Rollup merge of #142364 - Kobzol:download-ci-incremental-warning-remove, r=RalfJung
Do not warn on `rust.incremental` when using download CI rustc

Discussed on Zulip.

r? `@RalfJung`
2025-06-11 22:58:29 +02:00
Matthias Krüger
507c57554d
Rollup merge of #142346 - Shourya742:2025-06-11-add-tracing-import-to-execution-context, r=Kobzol
Add tracing import to execution context

In https://github.com/rust-lang/rust/pull/141909, we missed adding the trace_cmd import in the execution context module. This PR fixes that. Additionally, we are updating the mingw-check-2 check command to include BOOTSTRAP_TRACING=1 to help ensure we don't miss such cases in future PRs.

r? `@Kobzol`
2025-06-11 22:58:27 +02:00
Stypox
8dac423f82
Add bootstrap option to compile a tool with features 2025-06-11 21:50:21 +02:00
bors
e703dff8fe Auto merge of #142358 - matthiaskrgr:rollup-fxe6m7k, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141967 (Configure bootstrap backport nominations through triagebot)
 - rust-lang/rust#142042 (Make E0621 missing lifetime suggestion verbose)
 - rust-lang/rust#142272 (tests: Change ABIs in tests to more future-resilient ones)
 - rust-lang/rust#142282 (Only run `citool` tests on the `auto` branch)
 - rust-lang/rust#142297 (Implement `//@ needs-target-std` compiletest directive)
 - rust-lang/rust#142298 (Make loongarch-none target maintainers more easily pingable)
 - rust-lang/rust#142306 (Dont unwrap and re-wrap typing envs)
 - rust-lang/rust#142324 (Remove unneeded `FunctionCx` from some codegen methods)
 - rust-lang/rust#142328 (feat: Add `bit_width` for unsigned integer types)

Failed merges:

 - rust-lang/rust#141639 (Expose discriminant values in stable_mir)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-11 17:51:57 +00:00