Commit graph

162638 commits

Author SHA1 Message Date
bors
52882f6522 Auto merge of #119899 - onur-ozkan:redesign-stage0-std, r=albertlarsan68,jieyouxu,mark-simulacrum,kobzol,jyn514,Noratrieb,WaffleLapkin,RalfJung,bjorn3
redesign stage 0 std

### Summary

**Blog post: https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/**

This PR changes how bootstrap builds the stage 1 compiler by switching to precompiled stage 0 standard library instead of building the in-tree one. The goal was to update bootstrap to use the beta standard library at stage 0 rather than compiling it from source (see the motivation at https://github.com/rust-lang/compiler-team/issues/619).

Previously, to build a stage 1 compiler bootstrap followed this path:

```
download stage0 compiler -> build in-tree std -> compile stage1 compiler with in-tree std
```

With this PR, the new path is:

```
download stage0 compiler -> compile stage1 compiler with precompiled stage0 std
```

This also means that `cfg(bootstrap)`/`cfg(not(bootstrap))` is no longer needed for library development.

### Building "library"

Since stage0 `std` is no longer in-tree `x build/test/check library --stage 0` is now no-op. The minimum supported stage to build `std` is now 1. For the same reason, default stage values in the library profile is no longer 0.

Because building the in-tree library now requires a stage1 compiler, I highly recommend library developers to enable `download-rustc` to speed up compilation time.

<hr>

**Blog post: https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/**

If you encounter a bug or unexpected results please open a topic in the [#t-infra/bootstrap](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap) Zulip channel or create a [bootstrap issue](https://github.com/rust-lang/rust/issues/new?template=bootstrap.md).

(Review thread: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Review.20thread.3A.20stage.200.20redesign.20PR/with/508271433)

~~Blocked on https://github.com/rust-lang/rust/pull/122709~~

try-job: dist-x86_64-linux
try-job: `x86_64-msvc*`
try-job: `x86_64-apple-*`
try-job: `aarch64-apple`
try-job: x86_64-gnu
try-job: `x86_64-gnu-llvm*`
2025-06-02 07:49:18 +00:00
bors
99e7c15e81 Auto merge of #141869 - GuillaumeGomez:rollup-vicg807, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#140370 (Improve diagnostics for usage of qualified paths within tuple struct exprs/pats)
 - rust-lang/rust#141224 (terminology: allocated object → allocation)
 - rust-lang/rust#141622 (implement `va_arg` for `powerpc`)
 - rust-lang/rust#141666 (source_span_for_markdown_range: fix utf8 violation)
 - rust-lang/rust#141789 (Exclude `CARGO_HOME` from `generate-copyright` in-tree determination)
 - rust-lang/rust#141823 (Drive-by refactor: use `OnceCell` for the reverse region SCC graph)
 - rust-lang/rust#141834 (Add unimplemented `current_dll_path()` for WASI)
 - rust-lang/rust#141846 (Fix TLS model on bootstrap for cygwin)
 - rust-lang/rust#141852 (resolve if-let-chain FIXME on bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-01 18:26:36 +00:00
Guillaume Gomez
90f418fbb3
Rollup merge of #141852 - onur-ozkan:resolve-if-let-fixme, r=jieyouxu
resolve if-let-chain FIXME on bootstrap

self-explanatory
2025-06-01 19:35:46 +02:00
Guillaume Gomez
f714b34000
Rollup merge of #141846 - Berrysoft:cygwin-bootstrap-tls, r=mati865
Fix TLS model on bootstrap for cygwin

There aren't other targets that both use emutls and enable `has_thread_local`, so cygwin triggers this bug first.

r? mati865

See: https://github.com/rust-lang/rust/pull/141719#issuecomment-2925445263

``@jeremyd2019`` Could you check if this PR fixes the issue? I just found my pre-built stage-0 rustc was too old to build the current rustc :(
2025-06-01 19:35:45 +02:00
Guillaume Gomez
fec5c8fd7c
Rollup merge of #141789 - ferrocene:hoverbear/exclude-cargo-home-from-in-tree-consideration, r=clubby789
Exclude `CARGO_HOME` from `generate-copyright` in-tree determination

On Ferrocene, we noticed that in our releases the out-of-tree notices were not being included. When `x.py run generate-copyright` was ran on local development machines, it worked fine.

After some investigations ``@tshepang`` and I determined that the problem was that the cargo registry (located in `CARGO_HOME`) started with the source directory on CI jobs, and was being excluded by this line:

15825b7161/src/tools/generate-copyright/src/cargo_metadata.rs (L85-L88)

In Ferrocene's `run.sh` we set `CARGO_HOME` to be `build/cargo-home`: 96a45dd9a1/ferrocene/ci/run.sh (L34-L46) which caused this issue.

This PR passes the `CARGO_HOME` variable to the `generate-copyright` tool and expands the consideration of in-tree-ness to be aware of `CARGO_HOME`. It is an upstreaming of https://github.com/ferrocene/ferrocene/pull/1491.

## Testing

Run `CARGO_HOME=build/cargo-home ./x.py run generate-copyright` on `master`, then check `build/host/doc/COPYRIGHT` and look for out of tree dependencies (at the bottom).

Then, try running the same command in this branch.
2025-06-01 19:35:44 +02:00
Ralf Jung
0884c683ad tweak comment and use a weaker fence 2025-06-01 16:32:18 +02:00
Noratrieb
b88cbed741 Make sure to sync on file-io.rs tokio test
Tokio `AsyncWriteExt::write` doesn't actually ensure that the contents
have written, it just *starts* the write operation. To ensure that the
file has actually been written, we need to `sync_all` first.
2025-06-01 15:43:14 +02:00
onur-ozkan
a71c00a713 resolve if-let-chain FIXME on bootstrap
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-01 14:43:02 +03:00
Noratrieb
9f8e157a1f Fix tokio/file-io.rs test relying on read/write not being short
The test did `write` and `read` and hoped that it would read/write
everything, which doesn't always happen and caused CI failures.
Switch to `write_all` and `read_to_end` to make it more reliable.
2025-06-01 11:43:55 +02:00
王宇逸
810a564d9b Fix TLS model on bootstrap for cygwin 2025-06-01 14:56:54 +08:00
The Miri Cronjob Bot
2150180050 Merge from rustc 2025-06-01 05:05:10 +00:00
The Miri Cronjob Bot
de289e45fd Preparing for merge from rustc 2025-06-01 04:57:44 +00:00
Jacob Pratt
ac49339e03
Rollup merge of #141521 - ruancomelli:const-float-rounding, r=RalfJung
Add `const` support for float rounding methods

# Add `const` support for float rounding methods

This PR makes the following float rounding methods `const`:

- `f64::{floor, ceil, trunc, round, round_ties_even}`
- and the corresponding methods for `f16`, `f32` and `f128`

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

## Procedure

I followed c09ed3e767 as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli.

## Note

This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
2025-06-01 00:35:53 +02:00
Jacob Pratt
c4ba6b00cc
Rollup merge of #141277 - RalfJung:miri-ci, r=oli-obk
Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target

The aarch64 target is more important, and also this ensures we cover all main architectures (x86_64, i686, aarch64) in PR CI.
2025-06-01 00:35:51 +02:00
Jacob Pratt
241ec137fb
Rollup merge of #141072 - Rynibami:stabilize-const-result-flatten, r=jhpratt
Stabilize feature `result_flattening`

Stabilizes the `Result::flatten` method

## Implementations

- [x] Implementation `Result::flatten`: https://github.com/rust-lang/rust/pull/70140
- [x] Implementation `const` `Result::flatten`: https://github.com/rust-lang/rust/pull/130692
- [x] Update stabilization attribute macros (this PR)

## Stabilization process

- [x] Created this PR [suggested](https://github.com/rust-lang/rust/issues/70142#issuecomment-2885044548) by ``@RalfJung``
- [x] FCP (haven't found any, is it applicable here?)
- [ ] Close issue rust-lang/rust#70142
2025-06-01 00:35:50 +02:00
Ruan Comelli
f8e97badb2
Add const support for float rounding methods
Add const support for the float rounding methods floor, ceil, trunc,
fract, round and round_ties_even.
This works by moving the calculation logic from

     src/tools/miri/src/intrinsics/mod.rs

into

     compiler/rustc_const_eval/src/interpret/intrinsics.rs.

All relevant method definitions were adjusted to include the `const`
keyword for all supported float types: f16, f32, f64 and f128.

The constness is hidden behind the feature gate

     feature(const_float_round_methods)

which is tracked in

     https://github.com/rust-lang/rust/issues/141555

This commit is a squash of the following commits:
- test: add tests that we expect to pass when float rounding becomes const
- feat: make float rounding methods `const`
- fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs`
- revert: undo update to `library/stdarch`
- refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one
- fix: add `#[cfg(not(bootstrap))]` to new const method tests
- test: add extra sign tests to check `+0.0` and `-0.0`
- revert: undo accidental changes to `round` docs
- fix: gate `const` float round method behind `const_float_round_methods`
- fix: remove unnecessary `#![feature(const_float_methods)]`
- fix: remove unnecessary `#![feature(const_float_methods)]` [2]
- revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs`
- fix: adjust after rebase
- test: fix float tests
- test: add tests for `fract`
- chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128`
- fix: adjust NaN when rounding floats
- chore: add FIXME comment for de-duplicating float tests
- test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs`
- test: fix tests after upstream simplification of how float tests are run
2025-05-31 15:26:57 -03:00
Matthias Krüger
23cc24e0bf
Rollup merge of #141819 - mati865:windows-gnullvm-host-fixes, r=jieyouxu
Fixes for building windows-gnullvm hosts

Split out from: https://github.com/rust-lang/rust/pull/140772
2025-05-31 18:51:51 +02:00
Matthias Krüger
387170c74b
Rollup merge of #141740 - nnethercote:hir-ItemKind-field-order, r=fee1-dead
Hir item kind field order

A follow-up to rust-lang/rust#141675.

r? `@fee1-dead`
2025-05-31 18:51:48 +02:00
Matthias Krüger
ec39208527
Rollup merge of #141646 - jieyouxu:distcheck, r=Mark-Simulacrum
Document what `distcheck` is intended to exercise

Or at least attempt to.

Closes rust-lang/rust#141387.

cc `@marcoieni` (re. [#t-infra/bootstrap > Speed up distcheck](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Speed.20up.20distcheck/with/520208870))
r? `@Mark-Simulacrum` (as you may have some clues about if this is accurate)
2025-05-31 18:51:48 +02:00
Mateusz Mikuła
885184ae41 Shared libLLVM linking is officially supported with MinGW and Clang 2025-05-31 16:06:08 +02:00
Mateusz Mikuła
7eea11b27c Fix C++ standard library name for *-windows-gnullvm targets 2025-05-31 15:58:43 +02:00
Mateusz Mikuła
98961cd3da Fix incorrect comment 2025-05-31 15:58:43 +02:00
Michael Goulet
3253de651f Add some new solver to PGO 2025-05-31 09:54:28 +00:00
Ralf Jung
c37010f8d6
Merge pull request #4361 from nia-e/remove-oopsie
Remove useless file
2025-05-31 06:22:44 +00:00
Nia Espera
669ebcad12
accidentally committed file 2025-05-31 07:55:24 +02:00
The Miri Cronjob Bot
449ec7b3fe Merge from rustc 2025-05-31 05:01:23 +00:00
The Miri Cronjob Bot
34cdfb75c1 Preparing for merge from rustc 2025-05-31 04:54:03 +00:00
bors
7a7bcbbcdb Auto merge of #141796 - weihanglo:update-cargo, r=weihanglo
Update cargo

12 commits in 68db37499f2de8acef704c73d9031be6fbcbaee4..64a12460708cf146e16cc61f28aba5dc2463bbb4
2025-05-22 14:27:15 +0000 to 2025-05-30 18:25:08 +0000
- chore: remove HTML comments and inline guide (rust-lang/cargo#15613)
- Add .git-blame-ignore-revs (rust-lang/cargo#15612)
- refactor: cleanup for `CompileMode` (rust-lang/cargo#15608)
- refactor: separate "global" mode from CompileMode (rust-lang/cargo#15601)
- fix(doc): pass `toolchain-shared-resources` to get doc styled (rust-lang/cargo#15605)
- fix(embedded): Resolve multiple bugs in frontmatter parser (rust-lang/cargo#15573)
- chore: Upgrade schemars (rust-lang/cargo#15602)
- Update gix & socket2 (rust-lang/cargo#15600)
- Add `-Zfix-edition` (rust-lang/cargo#15596)
- chore(toml): disable `toml`'s default features, unless necessary (rust-lang/cargo#15598)
- docs(README): fix the link to the changelog in the Cargo book (rust-lang/cargo#15597)
- Add the future edition (rust-lang/cargo#15595)

r? ghost
2025-05-31 01:33:21 +00:00
bors
0b00e6847b Auto merge of #141791 - workingjubilee:rollup-qnqicy9, r=workingjubilee
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#140825 (Add Range parameter to `BTreeMap::extract_if` and `BTreeSet::extract_if`)
 - rust-lang/rust#141077 (Fix the issue of typo of comma in arm parsing)
 - rust-lang/rust#141237 (Implement ((un)checked_)exact_div methods for integers)
 - rust-lang/rust#141494 (mir-opt: Do not transform non-int type in match_branches)
 - rust-lang/rust#141609 (core: begin deduplicating pointer docs)
 - rust-lang/rust#141768 (ci: use arm to calculate job matrix)
 - rust-lang/rust#141771 (Increase timeout for new bors try builds)
 - rust-lang/rust#141781 (Fix spans for unsafe binders)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-30 22:14:00 +00:00
Weihang Lo
01541e177c
Update cargo 2025-05-30 17:23:09 -04:00
Jubilee
a7e56bff08
Rollup merge of #140825 - rs-sac:ext, r=workingjubilee
Add Range parameter to `BTreeMap::extract_if` and `BTreeSet::extract_if`

This new parameter was requested in the btree_extract_if tracking issue:  https://github.com/rust-lang/rust/issues/70530#issuecomment-2486566328

I attempted to follow the style used by `Vec::extract_if`.

Before:

```rust
impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
    #[unstable(feature = "btree_extract_if", issue = "70530")]
    pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F, A>
    where
        K: Ord,
        F: FnMut(&K, &mut V) -> bool;
}
```

After:

```rust
impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
    #[unstable(feature = "btree_extract_if", issue = "70530")]
    pub fn extract_if<F, R>(&mut self, range: R, pred: F) -> ExtractIf<'_, K, V, R, F, A>
    where
        K: Ord,
        R: RangeBounds<K>,
        F: FnMut(&K, &mut V) -> bool;
}
```

Related: #70530

—

While I believe I have adjusted all of the necessary bits, as this is my first attempt to contribute to Rust, I may have overlooked something out of ignorance, but if you can point out any oversight, I shall attempt to remedy it.
2025-05-30 13:52:24 -07:00
Ana Hobden
f886925ed3
Exclude CARGO_HOME from generate-copyright in-tree determination 2025-05-30 12:52:50 -07:00
bors
70b3f4666e Auto merge of #141657 - petrochenkov:nobinroot, r=jieyouxu
bootstrap: Remove `bin_root` from `PATH`

It's not currently load bearing in typical setups on typical targets.
Basically, if it passes the standard CI, then we can remove it, I think.

If someone later reports this breaking the build, then we can address it in a more fine grained way.
E.g. add it to `PATH` last and not first, only on specific targets, and only if specific files are not already found in `PATH` directories.

Fixes [#t-infra/bootstrap > Build broken in MSYS2 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Build.20broken.20in.20MSYS2/near/520709527)
2025-05-30 18:56:37 +00:00
onur-ozkan
a577bcc077 fix clippy warnings
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:33 +03:00
onur-ozkan
d2a6990122 fix bootstrap tests
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:28 +03:00
onur-ozkan
305890541f fix fs bug on CI and update ming-check-1 Dockerfile
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:25 +03:00
onur-ozkan
60394a807d fix CI-rustc bugs
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:22 +03:00
onur-ozkan
1ab2ba300c be able to build stage1 library with CI-rustc
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:20 +03:00
onur-ozkan
2938c8d310 add "library" to RUSTC_IF_UNCHANGED_ALLOWED_PATHS
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:17 +03:00
onur-ozkan
fcee761e50 improve comments and docs
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:14 +03:00
onur-ozkan
caca33192b add change entry
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:11 +03:00
onur-ozkan
9df53f58b4 update dev guidelines
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:08 +03:00
onur-ozkan
2b780cd517 split mingw-check into two
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:05 +03:00
onur-ozkan
d28cb1ceac use stage 1 for std on CI
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:04:02 +03:00
onur-ozkan
0803f62605 bless bootstrap tests
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:03:59 +03:00
onur-ozkan
4d5dab3f38 update stage defaults
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:03:57 +03:00
onur-ozkan
37cd39f3ce handle cfg bootstrap on compiler and miri
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:03:54 +03:00
onur-ozkan
613eceb80e improve check::Std handling
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:03:52 +03:00
onur-ozkan
c5adf58599 update std uplifting algorithm
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:03:49 +03:00
onur-ozkan
5dc0d89abc use initial rustc's std on stage 0
On stage 0, rather than compiling std utilize the one from the stage0 sysroot
as stage 0 should represent the snapshot version not the compiled one.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30 21:03:46 +03:00