Skip to content

Rustc pull update #2461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jun 9, 2025
Merged

Rustc pull update #2461

merged 29 commits into from
Jun 9, 2025

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Jun 9, 2025

Latest update from rustc.

bors and others added 29 commits June 3, 2025 13:09
Use ccache for stage0 tool builds

Now after the stage0 redesign, we can actually start ccaching the build of the compiler itself. We can also cache the bootstrap tools, since these are also built with the stage0 compiler.

Stage0 compiler builds are now being cached: https://github.com/rust-lang/rust/actions/runs/15397246267#summary-43321151192 (`..bootstrap::core::build_steps::compile::Rustc	483.10s	40.41s	-91.6%`). It's not a gigantic win everywhere, but it should help. It seems to make the Linux jobs ~10 minute faster. It should be especially useful on PR builds after rust-lang/rust#141948.

r? `@jieyouxu`

try-job: `x86_64-gnu-llvm-19*`
try-job: `x86_64-msvc*`
try-job: `x86_64-apple*`
try-job: `dist-x86_64-linux`
Merge `compiler-builtins` as a Josh subtree

Use the Josh [1] utility to add `compiler-builtins` as a subtree, which
will allow us to stop using crates.io for updates. This is intended to
help resolve some problems when unstable features change and require
code changes in `compiler-builtins`, which sometimes gets trapped in a
bootstrap cycle.

This was done using `josh-filter` built from the r24.10.04 tag:

    git fetch https://github.com/rust-lang/compiler-builtins.git 233434412fe7eced8f1ddbfeddabef1d55e493bd
    josh-filter ":prefix=library/compiler-builtins" FETCH_HEAD
    git merge --allow-unrelated FILTERED_HEAD

The HEAD in the `compiler-builtins` repository is 233434412f ("fix an if
statement that can be collapsed").

[1]: https://github.com/josh-project/josh
Move placeholder handling to a proper preprocessing step

This commit breaks out the logic of placheolder rewriting into its own preprocessing step. It's one of the more boring
parts of #130227.

The only functional change from this is that the preprocessing step (where extra `r: 'static` constraints are added) is performed upstream of Polonius legacy, finally affecting Polonius. That is mostly a by-product, though.

This should be reviewable by anyone in the compiler team, so
r? rust-lang/compiler
…rkingjubilee

UnsafePinned: also include the effects of UnsafeCell

This tackles rust-lang/rust#137750 by including an `UnsafeCell` in `UnsafePinned`, thus imbuing it with all the usual properties of interior mutability (no `noalias` nor `dereferenceable` on shared refs, special treatment by Miri's aliasing model). The soundness issue is not fixed yet because coroutine lowering does not use `UnsafePinned`.

The RFC said that `UnsafePinned` would not permit mutability on shared references, but since then, rust-lang/rust#137750 has demonstrated that this is not tenable. In the face of those examples, I propose that we do the "obvious" thing and permit shared mutable state inside `UnsafePinned`. This seems loosely consistent with the fact that we allow going from `Pin<&mut T>` to `&T` (where the former can be aliased with other pointers that perform mutation, and hence the same goes for the latter) -- but the `as_ref` example shows that we in fact would need to add this `UnsafeCell` even if we didn't have a safe conversion to `&T`, since for the compiler and Miri, `&T` and `Pin<&T>` are basically the same type.

To make this possible, I had to remove the `Copy` and `Clone` impls for `UnsafePinned`.

Tracking issue: rust-lang/rust#125735
Cc ``@rust-lang/lang`` ``@rust-lang/opsem``  ``@Sky9x``
I don't think this needs FCP since the type is still unstable -- we'll finally decide whether we like this approach when `UnsafePinned` is moved towards stabilization (IOW, this PR is reversible). However, I'd still like to make sure that the lang team is okay with the direction I am proposing here.
Do not run PGO/BOLT in x64 Linux alt builds

Should unblock rust-lang/rust#131077 and also reduce our CI costs. It seems to run ~1.5h on the x64 larger runner (free runner runs out of disk space, sadly).

Discussed [here](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Utility.20of.20the.20.60dist-x86_64-linux-alt.60.20job/with/521324477).

r? ``@marcoieni``

try-job: `dist-x86_64-linux*`
update rust offload bootstrap

r? ``@ghost``
rustc-dev-guide subtree update

r? ``@jieyouxu``
`tests/ui`: A New Order [3/N]

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@jieyouxu``
implement new `x` flag: `--skip-std-check-if-no-download-rustc`

One of our developers (``@RalfJung)`` [reported](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Surprising.20stages.20for.20check.20build.20after.20stage.20reorg/with/521925606)[#t-infra/bootstrap > Surprising stages for check build after stage reorg](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Surprising.20stages.20for.20check.20build.20after.20stage.20reorg/with/521925606) that working on both the compiler and the library simultaneously with RA enabled is extremely difficult because checking library creates a heavy load on machines (by building stage1 compiler) on each modification. `--skip-std-check-if-no-download-rustc` flag is intended to reduce this heavy load on their IDE integration as much as possible.

Fixes: rust-lang/rust#141955
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#140638 (UnsafePinned: also include the effects of UnsafeCell)
 - rust-lang/rust#141777 (Do not run PGO/BOLT in x64 Linux alt builds)
 - rust-lang/rust#141938 (update rust offload bootstrap)
 - rust-lang/rust#141962 (rustc-dev-guide subtree update)
 - rust-lang/rust#141965 (`tests/ui`: A New Order [3/N])
 - rust-lang/rust#141970 (implement new `x` flag: `--skip-std-check-if-no-download-rustc`)

r? `@ghost`
`@rustbot` modify labels: rollup
jsondocck: Refactor directive handling

Best reviewed commit by commit.

1. Moves directive handling into its own file. This makes it easier to link to in the dev-guide (#2422 (comment)), but also makes the code nicer in it's own right
2. Renames command to directive. This is what compiletest uses, and it's nice to not have 2 words for this.

r? ``@GuillaumeGomez``
Fix parsing of frontmatters with inner hyphens

closes rust-lang/rust#141483

r? fee1-dead
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#141709 (jsondocck: Refactor directive handling)
 - rust-lang/rust#141974 (`tests/ui`: A New Order [4/N])
 - rust-lang/rust#141989 (rustdoc-json-type: Depend on `serde` and `serde_derive` seperately)
 - rust-lang/rust#142015 (Report the actual item that evaluation failed for)
 - rust-lang/rust#142026 (bootstrap: Fix file permissions when dereferencing symlinks)
 - rust-lang/rust#142032 (Fix parsing of frontmatters with inner hyphens)
 - rust-lang/rust#142036 (Update the `compiler-builtins` subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
… r=traviscross,jieyouxu

Add a new `mismatched-lifetime-syntaxes` lint

The lang-team [discussed this](https://hackmd.io/nf4ZUYd7Rp6rq-1svJZSaQ) and I attempted to [summarize](rust-lang/rust#120808 (comment)) their decision. The summary-of-the-summary is:

- Using two different kinds of syntax for elided lifetimes is confusing. In rare cases, it may even [lead to unsound code](rust-lang/rust#48686)! Some examples:

    ```rust
    // Lint will warn about these
    fn(v: ContainsLifetime) -> ContainsLifetime<'_>;
    fn(&'static u8) -> &u8;
    ```

- Matching up references with no lifetime syntax, references with anonymous lifetime syntax, and paths with anonymous lifetime syntax is an exception to the simplest possible rule:

    ```rust
    // Lint will not warn about these
    fn(&u8) -> &'_ u8;
    fn(&'_ u8) -> &u8;
    fn(&u8) -> ContainsLifetime<'_>;
    ```

- Having a lint for consistent syntax of elided lifetimes will make the [future goal](rust-lang/rust#91639) of warning-by-default for paths participating in elision much simpler.

---

This new lint attempts to accomplish the goal of enforcing consistent syntax. In the process, it supersedes and replaces the existing `elided-named-lifetimes` lint, which means it starts out life as warn-by-default.
Make #[used(linker)] the default on ELF too

`#[used]` currently is an alias for `#[used(linker)]` on all platforms except ELF based ones where it is an alias for `#[used(compiler)]`. The latter has surprising behavior and the LLVM LangRef explicitly states that it "should only be used in rare circumstances, and should not be exposed to source languages." [^2]

The reason `#[used]` still was an alias to `#[used(compiler)]` on ELF is because the gold linker has issues with it. Luckily gold has been deprecated with GCC 15 [^1] and seems to be unable to bootstrap rustc anyway [^3]. As such we shouldn't really care about supporting gold.

This would also allow re-enabling start-stop-gc with lld.

cc rust-lang/rust#93798
Likely fixes rust-lang/rust#85045

[^1]: https://lists.gnu.org/archive/html/info-gnu/2025-02/msg00001.html
[^2]: https://llvm.org/docs/LangRef.html#the-llvm-compiler-used-global-variable
[^3]: rust-lang/rust#139425
…e, r=Kobzol

modularize the config module bootstrap

Currently, our `config` module is quite large over 3,000 lines, and handles a wide range of responsibilities. This PR aims to break it down into smaller, more focused submodules to improve readability and maintainability:

* **`toml`**: Introduces a dedicated `toml` submodule within the `config` module. Its sole purpose is to define configuration-related structs along with their corresponding deserialization logic. It also contains the `parse_inner` method, which serves as the central function for extracting relevant information from the TOML structs and constructing the final configuration.

* **`rust`, `dist`, `install`, `llvm`, `build`, `gcc`, and others**: Each of these modules contains TOML subsections specific to their domain, along with the logic necessary to convert them into parts of the final configuration struct.

* **`config/mod.rs`**: Contains shared types and enums used across multiple TOML subsections.

* **`config/config.rs`**: Houses the logic that integrates all the TOML subsections into the complete configuration struct.

r? `@kobzol`
Fast path for stalled obligations on self ty

If we see that the `self` type of a goal is an infer var, then don't try to compute the goal at all, since we know that it'll be forced ambiguous.

This is currently only implemented when there are no opaques in the environment. We could extend it to check that the self type is not related to any already defined opaques via subtyping, but I'll leave that as a follow-up.

---

Also stall coerce and subtype predicates if both of their vars are not resolved to concrete types.

---

~~Also, we don't care if the goal is higher-ranked for the sized and copy/clone fast path.~~ pulling this out into another PR.

r? lcnr
Change per-module naked fn checks to happen during typeck instead

cc `@Lokathor` `@Amanieu` `@folkertdev`

just seems nicer this way
…ers, r=saethlin

bootstrap: build std sans leaf frame pointers

Sometimes leaf frame-pointers can impact LLVM inlining choices, and that can be a real problem for things like `mul_add`.
Fix `create-docs-artifacts.sh` with new bors

The slashes in the branch name (`automation/bors/try`) were causing issues for this script (https://github.com/rust-lang/rust/actions/runs/15391908130/job/43303193243).

r? `@marcoieni`

try-job: `mingw-check*`
bootstrap: Remove `rustc_snapshot_libdir` from PATH in one more place

Same as rust-lang/rust#141657 but in a different part of the build system, with the same goal of addressing [#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).

It seems to work on windows-{gnu,msvc} and linux-gnu at least.

r? jieyouxu
Move coroutine_by_move_body_def_id into the big check_crate body owner loop

This avoids starting a parallel loop in sequence and instead runs all the queries for a specific DefId together.
Remove CollectItemTypesVisitor

I always felt like we were very unnecessarily walking the HIR, let's see if perf agrees

There is lots to ~~improve~~ consolidate further here, as we still have 3 item wfchecks:

* check_item (matching on the hir::ItemKind)
    * actually doing trait solver based checks (by using HIR spans)
* lower_item (matching on the hir::ItemKind after loading it again??)
    * just ensure_ok-ing a bunch of queries
* check_item_type (matching on DefKind)
    * some type based checks, mostly ensure_ok-ing a bunch of queries

fixes rust-lang/rust#121429
Don't walk into `Certainty::Yes` goals

Don't walk into `Certainty::Yes` goals in the pending obligation finding code, since they will not have been stalled on an infer var anyways
Simplify and optimize `VecCache`'s `SlotIndex::from_index`

Simplify and optimize `SlotIndex::from_index`

Break out bucket 0 (containing `idx < 4096`) as an early return, which
simplifies the remainder of the function, and allows optimizing the
`checked_ilog2` since it can no longer return `None`.

This reduces the runtime of `vec_cache::tests::slot_index_exhaustive`
(which calls `SlotIndex::from_index` for every `u32`, twice) from ~15.5s
to ~13.3s.

Separately, simplify the test case as well. (The old and new code passes with
the old and new test case.)

---

Noticed because `slot_index_exhaustive` stood out as taking unusually long compared to other tests, so I started investigating what it was doing.
@rustbot
Copy link
Collaborator

rustbot commented Jun 9, 2025

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Jun 9, 2025
@rustbot rustbot closed this Jun 9, 2025
@rustbot rustbot reopened this Jun 9, 2025
@tshepang tshepang merged commit 06ddcae into master Jun 9, 2025
1 check passed
@tshepang tshepang deleted the rustc-pull branch June 9, 2025 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants