Commit graph

5954 commits

Author SHA1 Message Date
onur-ozkan
f6c4110b9d improve bootstrap to allow selecting llvm tools individually
Everything works as before, + now bootstrap allows for individually selecting LLVM
tools (e.g., `x dist opt llvm-dis`) to include in the dist artifact.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-31 17:45:17 +03:00
Matthias Krüger
4d78d11bf9
Rollup merge of #128342 - onur-ozkan:ci-env-usage, r=Kobzol
simplify the use of `CiEnv`

self-explanatory
2024-07-29 21:26:14 +02:00
onur-ozkan
06d64ea4c4 simplify the use of CiEnv
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29 16:33:44 +03:00
onur-ozkan
f56d58e4a7 ignore crates if running unit tests
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29 10:43:37 +03:00
onur-ozkan
d3aed2cdb4 remove the requirement of Builder arg in doc::Std::new function
`crates` field is handled in the `Step::make_run` just like in any other
`Std` implementation, so we don't need to resolve them in `Std::new`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29 10:43:35 +03:00
onur-ozkan
4c87e84f99 allow running x doc on std for no_std targets
Since we now handle library crates properly, there's no need to panic for `no_std`
targets anymore.

`x doc library` now generates documentation for the `alloc` crate from standard library.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29 10:43:31 +03:00
onur-ozkan
6e247195c6 handle no_std targets on std builds
This change unifies the `Step::run_make` logic and improves it by skipping
std specific crates for no_std targets.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29 10:43:24 +03:00
Matthias Krüger
9b82536776
Rollup merge of #128269 - onur-ozkan:improve-cargo-invocations, r=Mark-Simulacrum
improve cargo invocations on bootstrap

Fixes few of the `FIXME`s on cargo invocations and should be considered as blocker for https://github.com/rust-lang/rust/issues/128180.
2024-07-29 07:11:16 +02:00
Nicholas Nethercote
84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
bors
78c857394e Auto merge of #128301 - matthiaskrgr:rollup-9fyf587, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #125889 (Add migration lint for 2024 prelude additions)
 - #128215 (Update the reference)
 - #128263 (rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-28 14:04:13 +00:00
Matthias Krüger
20cf5ade15
Rollup merge of #128215 - ehuss:update-reference, r=Kobzol
Update the reference

This updates the reference to use the new mdbook-spec preprocessor, which is a Cargo library inside the reference submodule.

Note that this PR contains a bunch of bootstrap cleanup commits to assist with making sure the submodules are working correctly. All of the cleanup PRs should have a description in their commit. I'd be happy to move those to a separate PR if that makes review easier.

The main changes for the reference are:
- Move the `doc::Reference` bootstrap step out of the generic macro into a custom step.
    - This step needs to build rustdoc because the new mdbook-spec plugin uses rustdoc for generating links.
    - PATH is updated so that the rustdoc binary can be found.
- rustbook now includes the mdbook-spec plugin as a dependency.
- rustbook enables the mdbook-spec preprocessor.

I did a bunch of testing with the various commands and setups, such as:
- `submodules=true` and `submodules=false`
- having all submodules deinitialized
- not in a git repository

However, there are probably thousands of different permutations of different commands, settings, and environments, so there is a chance I'm missing something.
2024-07-28 13:42:19 +02:00
bors
1b51d80027 Auto merge of #127799 - Kobzol:bootstrap-cmd-refactor-7, r=onur-ozkan
Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of https://github.com/rust-lang/rust/pull/127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: https://github.com/rust-lang/rust/issues/126819

r? `@onur-ozkan`

try-job: x86_64-msvc
2024-07-28 11:40:27 +00:00
onur-ozkan
92ca0a6a04 improve check::{Std, Rustc} to handle clippy properly
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-27 21:46:16 +03:00
Eric Huss
1c98b8f922 Rename require_and_update_submodule to require_submodule
Just trying to be a little less verbose here.
2024-07-27 08:09:03 -07:00
Eric Huss
0f387eb39b Add clarifying documentation to require_and_update_submodule. 2024-07-27 08:06:20 -07:00
Eric Huss
78ee5d057b Change prebuilt_llvm_config to not be required.
I misread this one. It is only checking if LLVM needs to be rebuilt.
There is code below that handles the case where it is unable to compute
the stamp if the source is missing.
2024-07-27 08:06:04 -07:00
Eric Huss
686e27ef49 Change the blanket submodule update for library submodules to be required
These are required 100% of the time, but they are almost always required
for any command that runs Cargo in the main workspace.

Ideally, initializing these two standard library submodules would be
lazy and only initialized when required (see
https://github.com/rust-lang/rust/pull/82653). However, it would require
updating these in almost every Step (anything that runs `cargo` in the
main workspace).
2024-07-27 08:04:46 -07:00
Eric Huss
9b0115c743 Consistently use a string to represent a submodule.
This makes it easier to call these functions without needing to form a
Path.
2024-07-27 08:02:06 -07:00
Eric Huss
f76ab647d3 Add more descriptions to why submodules are required. 2024-07-27 07:59:37 -07:00
Eric Huss
5ebb821fa9 Fix mistake setting ONLY_HOSTS for Reference.
This was a copy/paste mistake.
2024-07-27 07:57:50 -07:00
onur-ozkan
d94e7ff065 refactor cargo invocations with strongly-typed subcommand
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-27 15:22:25 +03:00
onur-ozkan
139a713dc0 add change entry for rust.channel defaults
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-27 11:08:37 +03:00
Jakub Beránek
abd8768768
Fix storing of stdout/stderr in bootstrap commands that failed to start
Before, their stdout/stderr was forcefully set to `None`, even if the corresponding command tried to capture output.
2024-07-26 09:17:34 +02:00
Jakub Beránek
603c0afc99
Fix broken doc link 2024-07-26 09:17:34 +02:00
Jakub Beránek
29565e24e1
Fix usages of old command API 2024-07-26 09:17:34 +02:00
Jakub Beránek
82d5743e0b
Make it easier to detect when bootstrap tries to read uncaptured stdout/stderr
If e.g. only stdout is captured, but the caller tries to read stderr, previously
they would get back an empty string. Now the code will explicitly panic when
accessing an uncaptured output stream.
2024-07-26 09:17:34 +02:00
Jakub Beránek
c70d63ed72
Make command output capturing more explicit
Now there are separate functions for running a command without capturing, running while capturing stdout
and running while capturing everything. This should help avoid situations where stdout/stderr is accessed
when it was not captured.
2024-07-26 09:17:34 +02:00
Matthew Maurer
8bf9aeaa80 Update Android testing to API 21, matching NDK 26
We were running testing on API 18, which was already out of support for
NDK 25, and some of the ancient behavior in that image was causing
trouble when developing `rustc` features (#120326).

Update to the current LTS NDK 26, and to its minimum supported API 21.

Fixes: #120567
2024-07-26 00:52:42 +00:00
Eric Huss
53ef052d45 Integrate mdbook-spec for the reference.
This updates the reference which is now using a new mdbook plugin. This
requires a little extra work than a normal book because the plugin uses
`rustdoc` to generate links to the standard library. It also ensures
that the submodule is available for *any* command that uses rustbook,
since it is now part of the rustbook workspace.
2024-07-25 17:38:22 -07:00
Eric Huss
a20db06d5b Make sure submodules are checked out with x test
If the submodule is not checked out, then these tests would fail.
2024-07-25 17:10:08 -07:00
Eric Huss
18aa419583 Clarify comment about why bootstrap tests need src/doc/book 2024-07-25 16:40:58 -07:00
Eric Huss
bbe9056c2a Add require_and_update_submodule to ensure submodules exist
This adds a new method `require_and_update_submodule` to replace
`update_submodule`. This new method will generate an error if the
submodule doesn't actually exist. This replaces some ad-hoc checks that
were performing this function. This helps ensure that a good error
message is always displayed.

This also adds require_and_update_all_submodules which does this for
all submodules.

Ideally this should not have any change other than better error messages
when submodules are missing.
2024-07-25 16:40:37 -07:00
Eric Huss
ee75f24945 Fix rustbook submodule update location
I put this submodule update in the entirely wrong location. I put it in
the `RustcBook` step (for generating src/doc/rustc), when it really
should exist for all steps that use the `Rustbook` tool.
2024-07-25 16:26:21 -07:00
Eric Huss
6a449d97fe Remove outdated comment about update_submodule
Although its origins were in bootstrap.py, that code in bootstrap.py
no longer exists since it was removed.
2024-07-25 16:18:46 -07:00
Eric Huss
922fdd8462 Remove argument from the submodules method
The argument was not necessary, since it was only ever passed one
value that exists in the config itself.
2024-07-25 16:15:59 -07:00
Eric Huss
2c6222b3f2 Clarify comment on update_existing_submodules
This felt like an important point to me.
2024-07-25 16:13:01 -07:00
Eric Huss
6642f8dcfc Remove pub from update_existing_submodules
This is not used anywhere outside this module.
2024-07-25 16:10:54 -07:00
Eric Huss
5fa6ede9d4 Remove comment about bootstrap.py handling submodules
bootstrap.py handling of submodules was removed in
https://github.com/rust-lang/rust/pull/97513.
2024-07-25 15:39:27 -07:00
Matthias Krüger
1fe9726c95
Rollup merge of #128108 - onur-ozkan:ensure-std-for-precompiled-rustc, r=Kobzol
ensure std step before preparing sysroot

When using download-rustc, any stage other than 0 or 1 (e.g., cargo +stage2 build/doc) will fail to find std while compiling on simple rust sources. Ensuring the std step fixes this issue.

r? Kobzol
2024-07-24 05:05:37 +02:00
onur-ozkan
2f55cedf50 ensure std step before preparing sysroot
When using download-rustc, any stage other than 0 or 1 (e.g., cargo +stage2 build/doc) will
fail to find std while compiling on simple rust sources. Ensuring the rustc step fixes
this issue.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-23 20:51:35 +03:00
Matthias Krüger
041b8c4447
Rollup merge of #128098 - onur-ozkan:incompatible-option-behaviour, r=Kobzol
make it possible to disable download-rustc if it's incompatible

Primarily needed by CI runners to avoid handling download-rustc incompatible options one by one on shell scripts.

This will significantly help to #122709.
2024-07-23 19:42:38 +02:00
Matthias Krüger
417bdc7036
Rollup merge of #128060 - alexcrichton:include-wasm-component-ld-for-real-this-time-maybe-let-see-after-this-merges, r=onur-ozkan
Fix inclusion of `wasm-component-ld` in dist artifacts

This is another accidental omission from #126967 (in addition to #127867) which fixes an issue where `wasm-component-ld` isn't distributed via rustup just yet because while it's present in the sysroot it's not present in the tarballs.
2024-07-23 19:42:37 +02:00
onur-ozkan
d4f3673a54 make it possible to disable download-rustc if it's incompatible
Primarily needed by CI runners to avoid handling download-rustc incompatible
options one by one on shell scripts.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-23 18:02:01 +03:00
Alex Crichton
c3d3d6fe02 Fix inclusion of wasm-component-ld in dist artifacts
This is another accidental omission from #126967 (in addition
to #127867) which fixes an issue where `wasm-component-ld` isn't
distributed via rustup just yet because while it's present in the
sysroot it's not present in the tarballs.
2024-07-22 07:57:53 -07:00
Eric Huss
5dfa062b87 Move rustbook to its own workspace. 2024-07-22 07:20:57 -07:00
许杰友 Jieyou Xu (Joe)
27550f4fa4
Rollup merge of #127510 - tgross35:test-float-parse-update, r=Mark-Simulacrum
Rewrite `test-float-parse` in Rust

Migrate from the currently broken Rust + Python `test-float-parse` to a Rust implementation. This newer version should be significantly faster (tests execute in parallel with threads, rather than series across multiple processes, which also eliminates the "...the worker processes are leaked and stick around forever" message), and should be significantly easier to extend to the new float types.

Since this is faster and hopefully more stable, we should be able to launch it with `x` and run the faster tests in CI.
2024-07-22 16:44:04 +08:00
许杰友 Jieyou Xu (Joe)
b66b4020d8
Rollup merge of #127177 - bjorn3:arm64_macos_cg_clif, r=Mark-Simulacrum
Distribute rustc_codegen_cranelift for arm64 macOS

Support for arm64 macOS has been added to rustc_codegen_cranelift recently.

Fixes https://github.com/rust-lang/rustc_codegen_cranelift/issues/1502
2024-07-22 16:44:02 +08:00
Trevor Gross
d12387835f Run test-float-parse as part of CI
With the previous improvements, it is now possible to run float parsing
tests as part of CI. Enable it here.

This only runs a subset of tests, which takes about one minute.
2024-07-21 11:57:10 -05:00
Trevor Gross
6062059ab0 Expose test-float-parse via bootstrap
With updates to `test-float-parse`, it is now possible to run as another
Rust tool. Enable check, clippy, and test.

Test runs the unit tests, as well as shorter parsing tests (takes
approximately 1 minute).
2024-07-20 11:39:34 -05:00
Matthias Krüger
3a9bfa397d
Rollup merge of #127463 - onur-ozkan:precompiled-rustdoc, r=Kobzol
use precompiled rustdoc with CI rustc

When CI rustc is enabled and rustdoc sources are unchanged, we can use the precompiled rustdoc from the CI rustc's sysroot. This speeds up bootstrapping quite a lot by avoiding unnecessary rustdoc compilation.
2024-07-20 13:24:51 +02:00