about summary refs log tree commit diff
path: root/src/bootstrap
AgeCommit message (Collapse)AuthorLines
2025-03-10Add change tracker entryJakub Beránek-0/+5
2025-03-10Implement downloading GCC from CIJakub Beránek-20/+104
2025-03-10Add `download-ci-gcc-stamp` fileJakub Beránek-0/+4
2025-03-10Add `[gcc] download-ci-gcc` optionJakub Beránek-1/+27
2025-03-10Add `gcc` bootstrap config sectionJakub Beránek-1/+8
2025-03-10Refactor GCC compilationJakub Beránek-105/+112
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-9/+4
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-09Rollup merge of #138233 - smmalis37:no-advapi32, r=ChrisDentonMatthias Krüger-2/+4
Windows: Don't link std (and run-make) against advapi32, except on win7 Std no longer depends on any functionality provided by advapi32, so we can remove it from the list of external libraries we link against. Except, the win7 targets do still rely on advapi32-provided functionality. This PR therefore moves linking against it to only occur on win7 targets, so that no new uses of it slip in without being noticed.
2025-03-09Rollup merge of #138232 - Kobzol:gcc-reduce-verbosity, r=GuillaumeGomezMatthias Krüger-2/+11
Reduce verbosity of GCC build log It was a bit too spammy before. Fixes: https://github.com/rust-lang/rust/issues/138213 r? ``@GuillaumeGomez``
2025-03-09Rollup merge of #138216 - Zalathar:any-debug, r=onur-ozkanMatthias Krüger-2/+75
bootstrap: Fix stack printing when a step cycle is detected When bootstrap detects a step dependency cycle (which represents a bootstrap bug), it is supposed to print out the contents of the step stack as part of its panic message. However, while investigating #138205 it was found that bootstrap was actually printing out several copies of `Any { .. }`, because that is the Debug implementation for `dyn Any`. This is sadly not very helpful. This PR fixes that problem by introducing a `trait AnyDebug: Any + Debug` that delegates to the underlying type's Debug implementation, while still allowing downcasting via Any. --- The fixed behaviour can be verified manually (and is tested automatically) via a new dummy command, `./x run cyclic-step`: ``` $ x run cyclic-step Building bootstrap Finished `dev` profile [unoptimized] target(s) in 0.02s thread 'main' panicked at src/bootstrap/src/core/builder/mod.rs:1521:17: Cycle in build detected when adding CyclicStep { n: 0 } CyclicStep { n: 0 } CyclicStep { n: 1 } CyclicStep { n: 2 } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Build completed unsuccessfully in 0:00:00 ```
2025-03-09Rollup merge of #138084 - nnethercote:workspace-lints, r=jieyouxuMatthias Krüger-4/+9
Use workspace lints for crates in `compiler/` This is nicer and hopefully less error prone than specifying lints via bootstrap. r? ``@jieyouxu``
2025-03-09Auto merge of #137541 - onur-ozkan:fix-cargo-clippy-bin, r=jieyouxubors-4/+15
add `tool::CargoClippy` and `tool::Cargofmt` binary to target sysroot When running `x build clippy`, we expect `stage1-tool-bin/cargo-clippy` and `stage2/bin/cargo-clippy` to be the same, but they aren't. This happens because `tool::CargoClippy` doesn't place its binary in the `stage2` directory. As a result, `stage1-tool-bin/cargo-clippy` comes from `tool::CargoClippy`, while `stage2/bin/cargo-clippy` comes from `tool::Cargo`. Same applies for `tool::Cargofmt`. This PR fixes the issue by adding `tool::CargoClippy` and ``tool::Cargofmt`` binaries to the expected sysroot and makes sure both directories share the same binary. To test this, run `x build --stage 2 compiler clippy rustfmt`, link the stage2 sysroot with rustup, and then call `cargo +stage2 fmt` and `cargo +stage2 clippy` on any rust project (it wouldn't work without this PR).
2025-03-08re-add gnu lib and tweak commentSteven Malis-2/+5
2025-03-08Don't link against advapi32, except on win7.Steven Malis-1/+0
2025-03-08Reduce verbosity of GCC build logJakub Beránek-2/+11
2025-03-08Auto merge of #138224 - onur-ozkan:fix-multiple-candidates, r=jieyouxubors-3/+11
skip `compile::Std` and `compile::Rustc` on `forced_compiler` Fixes https://github.com/rust-lang/rust/issues/138220 Set `download-rustc = true/false` and run `x test tests/ui/meta/no_std-extern-libc.rs --force-rerun` to debug it.
2025-03-08skip `compile::Std` and `compile::Rustc` on `forced_compiler`onur-ozkan-3/+11
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-08Auto merge of #138208 - jhpratt:rollup-hlqyu51, r=jhprattbors-5/+14
Rollup of 5 pull requests Successful merges: - #136642 (Put the alloc unit tests in a separate alloctests package) - #137528 (Windows: Fix error in `fs::rename` on Windows 1607) - #137685 (self-contained linker: conservatively default to `-znostart-stop-gc` on x64 linux) - #137757 (On long spans, trim the middle of them to make them fit in the terminal width) - #138189 (Mention `env` and `option_env` macros in `std::env::var` docs) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-08Update bootstrap to edition 2024Jakub Beránek-24/+51
2025-03-08bootstrap: Fix stack printing when a step cycle is detectedZalathar-2/+75
2025-03-08Rollup merge of #136642 - bjorn3:separate_alloctest_crate, r=cuviperJacob Pratt-5/+14
Put the alloc unit tests in a separate alloctests package Same rationale as https://github.com/rust-lang/rust/pull/135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
2025-03-08Auto merge of #138205 - onur-ozkan:fix-build-cycle, r=jieyouxubors-17/+21
handle precompiled compiler more properly Fixes the build cycle problem reported on [#t-infra/bootstrap > Cycle on &#96;aarch64-apple&#96;](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Cycle.20on.20.60aarch64-apple.60/with/504231609).
2025-03-08update doc-comment for `forced_compiler`onur-ozkan-2/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-08handle precompiled compiler more properlyonur-ozkan-15/+19
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-07Rollup merge of #137537 - jieyouxu:daily-rmake, r=KobzolJacob Pratt-1/+1
Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do Addresses (mostly) #137532. Follow-up to #137373. ### Summary - Fix 3 run-make tests that currently use unstable features: 1. `tests/run-make/issue-107495-archive-permissions/rmake.rs` uses `#![feature(rustc_private)]` for `libc` on `unix`, but `run_make_support` already exports `libc`, so just use that. 2. `tests/run-make/cross-lang-lto/rmake.rs` uses `#![feature(path_file_prefix)]` for convenience, replaced with similar filename prefix logic. 3. `tests/run-make/broken-pipe-no-ice/rmake.rs` uses `#![feature(anonymous_pipe)]` for anonymous pipes. This is more complicated[^race-condition], and I decided to temporarily introduce a dependency on [`os_pipe`] before std's `anonymous_pipe` library feature is stabilized[^pipe-stab]. I left a FIXME tracked by #137532 to make the switch once `anonymous_pipe` stabilizes and reaches beta. - Use `RUSTC_BOOTSTRAP=-1` when building `rmake.rs` to have the stage 0 rustc reject any unstable features used in `rmake.rs`. - The requirement that `rmake.rs` may not use any unstable features is now documented in rustc-dev-guide. - This PR does not impose `RUSTC_BOOTSTRAP=-1` when building `run-make-support`, but I suppose we could. r? `@Kobzol` try-job: x86_64-msvc-1 try-job: x86_64-mingw-1 [`os_pipe`]: https://github.com/oconnor663/os_pipe.rs [^race-condition]: We can't just try to spawn `rustc` and immediate close the stderr handle because of race condition, as there's no guarantee `rustc` will not try to print to stderr before the handle gets closed. [^pipe-stab]: In-progress stabilization PR over at https://github.com/rust-lang/rust/pull/135822.
2025-03-08Specify rust lints for `compiler/` crates via Cargo.Nicholas Nethercote-4/+9
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
2025-03-07Move all alloc integration tests to a new alloctests cratebjorn3-5/+14
2025-03-07Auto merge of #138148 - onur-ozkan:fix-llvm-bitcode-build, r=jieyouxubors-4/+4
use target compiler on llvm-bitcode-linker The build compiler is already resolved inside the `ToolBuild` step, so we should pass only the target compilers for `Mode::ToolRustc` tools. Fixes https://github.com/rust-lang/rust/issues/138123 r? ghost try-job: dist-powerpc64le-linux
2025-03-07Apply `--cfg windows_raw_dylib` for bootstrap tools tooJieyou Xu-1/+1
This is already applied for rustc/std tools. This is needed to make `windows` crates avoid trying to depend on a generated `windows.0.xx.0.lib`.
2025-03-07use target compiler on llvm-bitcode-linkeronur-ozkan-4/+4
The build compiler is already resolved inside the `ToolBuild` step, so we should pass only the target compilers for `Mode::ToolRustc` tools. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-06Rollup merge of #138078 - moxian:rember-warns, r=KobzolMichael Goulet-6/+7
Reduce the noise of bootstrap changelog warnings in --dry-run mode Presently x.py displays "There have been changes to x.py since you last updated:" note only once when run normally, but on every invocation when run with `--dry-run`. The disparity is not exactly intentonal, but just a historical accident. It was made to be printed once in https://github.com/rust-lang/rust/pull/117815 via storing `.last-warned-change-id` on disk in `{config.out}/bootstrap` (i.e. `build/bootstrap`) directory. But that didn't quite work for `--dry-run`, since `{config.out}/bootsrap` points to `build/tmp-dry-run/bootstrap` which *isn't* created in dry-run mode, so file creation fails. This got fixed in https://github.com/rust-lang/rust/pull/118789 and now `--dry-run` does not save `.last-warned-change-id` at all. (Nor does it read it, since it cannot know to read from non-dry-run location) This PR simply stops displaying the changelog altogether in --dry-run mode. <details> <summary>previous attempt (outdated)</summary> This PR takes a different approach, and instead of not-writing the stamp in `--dry-run` mode it instead tries harder to yes-write it, and, specifically, creates `build/tmp-dry-run/bootstrap` directory to do so. If neccessary (i.e. if there are changes newer than the `change-id` stamp of config.toml to warn about). Note that `build/tmp-dry-run/` was *already* being created, so making an extra `boostrap` sub-folder should not meaningfully pollute the build dir. </details> (Apologies for the, perhaps, excessively wordy PR, I'm new to this)
2025-03-06Rollup merge of #138041 - ↵Michael Goulet-3/+3
thaliaarchi:use-prelude-size-of.boostrap-compiletest, r=jieyouxu bootstrap and compiletest: Use `size_of_val` from the prelude instead of imported Use `std::mem::size_of_val` from the prelude instead of importing or qualifying it. This function was added to all preludes in Rust 1.80. r? ``@jieyouxu``
2025-03-06Auto merge of #138039 - onur-ozkan:handle-forced-compiler-on-tools, r=jieyouxubors-86/+145
handle forced compiler and revert #137476 Fixes https://github.com/rust-lang/rust/issues/138004 I would appreciate it if we could measure CI pipelines with the current changes to see if this reduces recent CI overhead. cc `@rust-lang/infra` try-job: dist-powerpc64le-linux
2025-03-06Don't even bother checking changelog in --dry-run modemoxian-6/+6
2025-03-05Leave a breadcrumb towards bootstrap config documentationmoxian-2/+3
2025-03-05Remember silenced bootstrap changelog warnings even in --dry-runmoxian-1/+2
2025-03-05bootstrap and compiletest: Use size_of_val from the prelude instead of importedThalia Archibald-3/+3
Use `std::mem::size_of_val` from the prelude instead of importing or qualifying it. This function was added to all preludes in Rust 1.80.
2025-03-05Rollup merge of #137723 - onur-ozkan:cfg-ver-description, ↵许杰友 Jieyou Xu (Joe)-3/+26
r=pietroalbini,weihanglo Make `rust.description` more general-purpose and pass `CFG_VER_DESCRIPTION` Moves the `description` field from the `rust` section to the `build` section as it can be useful for tools and is not specific to rustc. Also passes this value to tool builds through the `CFG_VER_DESCRIPTION` env. Motivated from https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Propagate.20rust.2Edescription.20to.20tools.20in.20dist.20build
2025-03-05Rollup merge of #137679 - bjorn3:coretests_improvements, r=jieyouxu,onur-ozkan许杰友 Jieyou Xu (Joe)-67/+24
Various coretests improvements The first commit is not yet strictly necessary as directly testing libcore works though useless work, but will be necessary once https://github.com/rust-lang/rust/pull/136642 migrates the liballoc tests into a separate package. The second commit fixes https://github.com/rust-lang/rust/issues/137478 and ensures that coretests actually gets tested on all CI job. The third commit fixes an error that didn't get caught because coretests doesn't run on the wasm32 CI job.
2025-03-05bless bootstrap testsonur-ozkan-1/+0
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-05Revert "avoid `compiler_for` for dist tools and force the current compiler"onur-ozkan-11/+47
This reverts commit 50f84129e66de867a735ee836339e8ed9dd7425e.
2025-03-05handle forced compiler in `get_tool_rustc_compiler`onur-ozkan-0/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-05add new field `forced_compiler` to `Compiler`onur-ozkan-75/+97
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-05replace `rust.description` with `build.description`onur-ozkan-1/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-05pass `CFG_VER_DESCRIPTION` to tool buildsonur-ozkan-0/+9
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-05add change-entryonur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-05move `rust.description` to `build.description`onur-ozkan-2/+11
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-04Rollup merge of #137667 - Kobzol:gcc-dist-build, r=onur-ozkanJubilee-0/+28
Add `dist::Gcc` build step This PR adds a `dist:Gcc` bootstrap step to distribute a prebuilt `libgccjit.so` from CI on x64 Linux. With primed sccache, the build takes ~4 minutes on CI, and produces a 50 MiB archive. I want to land this before adding something akin to `[gcc] download-ci-gcc = true`, to already have the artifacts available on CI, to make it easier to setup the download merge-base logic. r? ``@ghost``
2025-03-04Rollup merge of #137373 - Kobzol:tool-stage0-improve, r=jieyouxuJubilee-130/+47
Compile run-make-support and run-make tests with the bootstrap compiler It does not seem necessary to have to recompile run-make-support on changes to the local compiler/stdlib. This PR simplifies the implementation of a few tools, then switches rms to stage0 and also makes the handling of environment variables in run-make tests simpler. Best reviewed commit-by-commit. I can split it into multiple PRs if you want. Also tested that `COMPILETEST_FORCE_STAGE0=1 ./x test tests/run-make --stage 0` still works. Incredibly, it looks like it even passes more tests than on `master` :laughing: r? ``@jieyouxu``
2025-03-04Store bootstrap command-line into metricsJakub Beránek-0/+8