Skip to content

Rollup of 8 pull requests#157440

Merged
rust-bors[bot] merged 22 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-XlcBgjV
Jun 4, 2026
Merged

Rollup of 8 pull requests#157440
rust-bors[bot] merged 22 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-XlcBgjV

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

jakubadamw and others added 22 commits May 10, 2026 22:04
…l when a supertrait not implemented

compiler/rustc_trait_selection/src/traits/vtable.rs@`vtable_entries`:
The impossible predicates check in `vtable_entries` used
`instantiate_own` which only includes the method's own where-clauses,
not the parent trait's bounds. Replace it with
`instantiate_and_check_impossible_predicates` which also checks the
trait ref itself, so unsatisfied supertrait bounds are caught
and the method is marked `Vacant` instead of ICEing.
Upvar inference unconditionally unifies `tupled_upvars_ty` (via
`demand_suptype` near the bottom of `analyze_closure`), but skipped
unifying `coroutine_captures_by_ref_ty` whenever the closure args
already referenced an error. That left the captures-by-ref inference
variable unconstrained for tainted coroutine-closures, breaking the
invariant `has_self_borrows` relies on (`FnPtr` or `Error`).

If the body contains an unresolved `as _` cast, e.g.

```rust
//@ edition:2021
fn needs_fn_mut<T>(x: impl FnMut() -> T) {
    needs_fn_mut(async || x as _)
}
```

selection later reaches `has_self_borrows` and trips its
`_ => panic!()` arm.

Always equate `coroutine_captures_by_ref_ty` in the error path -- to
`Ty::new_error(guar)` -- so the invariant holds and downstream
consumers can rely on the inference variable being resolved.
… so we still collect generic bounds from the type
Treat the semantics of pointee.size as "dereferenceable-at-point"
and always specify the size. Instead, use a separate NoFree attribute
to determine whether dereferenceability extends to the whole function.

Then in the LLVM backend, only actually emit dereferenceable if
nofree is also set, as dereferenceable currently implies nofree.

In addition, explicitly emit the nofree attribute, which will help
when LLVM switches dereferenceable to be at-point.
Emit nofree attribute

Treat the semantics of pointee.size as "dereferenceable-at-point" and always specify the size. Instead, use a separate NoFree attribute to determine whether dereferenceability extends to the whole function.

Then in the LLVM backend, only actually emit dereferenceable if nofree is also set, as dereferenceable currently implies nofree.

In addition, explicitly emit the nofree attribute, which will help when LLVM switches dereferenceable to be at-point.

Relevant recent LLVM PR: llvm/llvm-project#195658
…ease

Eagerly decide whether relaxed bounds are allowed or not

r? @davidtwco or @fmease

Previously introduced in rust-lang#142693 by @fmease

I am trying to resolve https://github.com/rust-lang/rust/blob/d7986943e496ccb07987f4ad83c6f7033d725861/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs#L196, but then got into a rabbit hole somehwere.

I think this PR further unblocks resolving that FIXME, because it makes it easier to reason about whether we should be reporting an error about duplicate bounds or about relaxed bounds in general
rustc_borrowck: fix async closure error note to report AsyncFn rather than Fn

Fixes rust-lang#148391

Root cause:
`async` closures are treated like plain `Fn` closures because we never updated their kind after adding the async coroutine path.

Symptom:
The compiler note tells users `closure implements Fn…`, which is wrong for async closures and made the error message confusing. Notably `FnMut` does not suffer from this issue.

Fix:
Fixed the wording

Testing:
Updated a UI test stderr file to reflect the correct wording. It also clearly demonstrates what was wrong.
…captures-infer-ice, r=lcnr

Don't ICE in has_self_borrows when coroutine captures-by-ref ty is still inferred

Closes rust-lang#155999.

`coroutine_captures_by_ref_ty` is a fresh `next_ty_var` until upvar
inference unifies it to an `FnPtr`. If `has_self_borrows` is reached
before that — e.g. when the body contains an unresolved `as _` cast —
the `_ => panic!()` arm fires:

```rust
//@ edition:2021
fn needs_fn_mut<T>(x: impl FnMut() -> T) {
    needs_fn_mut(async || x as _)
}
```

Treat the `Infer` case like `Error`: report self-borrows defensively
so the closure falls back to `FnOnce`-only and the caller surfaces a
normal type-inference error instead of an ICE.
… r=lcnr

Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait is not implemented

This is a second incarnation of rust-lang#152287, which was reverted in rust-lang#152738 as it had exposed another underlying unsoundness (rust-lang#153596, exhibited indirectly in rust-lang#152735), which was recently fixed in rust-lang#155749.

It’s the same fix and the same set of tests. Regression tests for the unsoundness itself were already added in rust-lang#155749.

Closes rust-lang#137190.
Closes rust-lang#135470.
…ric-capabilities, r=lcnr

Support generic params in `Lift_Generic`

Handle generic type parameters, including nested occurrences, when deriving `Lift_Generic`.

This lets types like `Binder<I, T>` use `#[derive(Lift_Generic)]` instead of requiring a manual `Lift` impl.

Concretely it can now handle structs as follows;

```rs
// Generic type parameter
struct Binder<I: Interner, T> {
    // body
}

// Nested generic type parameter
pub struct Binder<I: Interner, T = SomeKind<I>> {
    //
}
```

Split off from the `Alias` refactor work; rust-lang#156538

r? @lcnr
 rustc_target: Use rustc_abi instead of cfg_abi to detect powerpcspe

When self-reviewing rust-lang#157137, I recalled a previous my comment (rust-lang#153876 (comment)) about a case where cfg_abi is referred but rustc_abi should be referred.

> There is another powerpc code that [refers to `abi` field](https://github.com/rust-lang/rust/blob/bfc05d6b072585dfd0c792ec1b8728c08a3511fe/compiler/rustc_target/src/asm/powerpc.rs#L125), but it should be changed to refer to the target feature.

`tests/codegen-llvm/asm/powerpc-clobbers.rs` contains a test to check whether this detection is working properly:
https://github.com/rust-lang/rust/blob/6368fd52cb9f230dfb156097625993e7a8891800/tests/codegen-llvm/asm/powerpc-clobbers.rs#L123

r? @RalfJung

@rustbot label +O-PowerPC +A-target-feature
…onathanBrouwer

Refactor/expand rustc_attr_parsing docs
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 4, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 4, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 4, 2026

📌 Commit b5058b6 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 4, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 4, 2026
Rollup of 8 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
try-job: i686-msvc-2
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 4, 2026

☀️ Try build successful (CI)
Build commit: 214fc33 (214fc336a55e66debbae9a8d0c297c1d38efa347, parent: 9ae765da471fd0bc3b305953e72c4eb12f304416)

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 4, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 4, 2026

☀️ Test successful - CI
Approved by: JonathanBrouwer
Duration: 3h 16m 22s
Pushing 688ab44 to main...

@rust-bors rust-bors Bot merged commit 688ab44 into rust-lang:main Jun 4, 2026
14 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 4, 2026
@rust-timer
Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#148713 rustc_borrowck: fix async closure error note to report Asyn… 85401fc3527adfc9bb75e988d93cf703967466fc (link)
#156266 Don't ICE in has_self_borrows when coroutine captures-by-re… c6bb2ad852ac7993921c18463863d2da0fcc840c (link)
#156281 Emit nofree attribute c770949a732744e4467ca215cd937d6ef1400294 (link)
#156417 Fix an ICE in the vtable iteration for a trait reference in… 0465a9f9bb1b3eb2aabaeccb2c073cdda6dd1839 (link)
#156956 Support generic params in Lift_Generic bb547f95cdc8b7cad4aa4473c31b6caa153f2b96 (link)
#157140 rustc_target: Use rustc_abi instead of cfg_abi to detect p… 5fb2ec476ece760a8fbdc99d501701b131ae86a4 (link)
#157305 Eagerly decide whether relaxed bounds are allowed or not 668ed9ce7ddb2eb2e9b4853e9f7ea56e0f6433a4 (link)
#157423 Refactor/expand rustc_attr_parsing docs de442b657c0a5e60019b279eec147ecd534c35d7 (link)

previous master: b3f7e32046

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing b3f7e32 (parent) -> 688ab44 (this PR)

Test differences

Show 94 test diffs

Stage 1

  • [crashes] tests/crashes/135470.rs: pass -> [missing] (J1)
  • [crashes] tests/crashes/137190-2.rs: pass -> [missing] (J1)
  • [crashes] tests/crashes/137190-3.rs: pass -> [missing] (J1)
  • [ui] tests/ui/async-await/async-closures/cast-as-infer-self-borrows.rs: [missing] -> pass (J1)
  • [ui] tests/ui/coercion/vtable-impossible-predicates-async.rs: [missing] -> pass (J1)
  • [ui] tests/ui/coercion/vtable-unsatisfied-supertrait-generics.rs: [missing] -> pass (J1)
  • [ui] tests/ui/coercion/vtable-unsatisfied-supertrait.rs: [missing] -> pass (J1)

Stage 2

  • [crashes] tests/crashes/135470.rs: pass -> [missing] (J0)
  • [crashes] tests/crashes/137190-2.rs: pass -> [missing] (J0)
  • [crashes] tests/crashes/137190-3.rs: pass -> [missing] (J0)
  • [ui] tests/ui/async-await/async-closures/cast-as-infer-self-borrows.rs: [missing] -> pass (J2)
  • [ui] tests/ui/coercion/vtable-impossible-predicates-async.rs: [missing] -> pass (J2)
  • [ui] tests/ui/coercion/vtable-unsatisfied-supertrait-generics.rs: [missing] -> pass (J2)
  • [ui] tests/ui/coercion/vtable-unsatisfied-supertrait.rs: [missing] -> pass (J2)

Additionally, 80 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 688ab44c7439a226d792990f81cd8df0603747d8 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-llvm-21: 1h 2m -> 1h 25m (+36.8%)
  2. x86_64-gnu-nopt: 1h 52m -> 2h 27m (+31.3%)
  3. x86_64-gnu-llvm-22-1: 1h 17m -> 57m 22s (-26.3%)
  4. x86_64-gnu-tools: 53m 55s -> 1h 7m (+26.0%)
  5. dist-x86_64-msvc-alt: 2h 52m -> 2h 8m (-25.6%)
  6. x86_64-gnu: 1h 52m -> 2h 21m (+25.5%)
  7. dist-arm-linux-gnueabi: 1h 11m -> 1h 29m (+25.4%)
  8. aarch64-apple: 3h 13m -> 2h 29m (-22.6%)
  9. dist-x86_64-freebsd: 1h 33m -> 1h 14m (-20.6%)
  10. i686-gnu-2: 1h 45m -> 1h 24m (-19.2%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (688ab44): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.2%] 2
Regressions ❌
(secondary)
0.9% [0.4%, 1.3%] 18
Improvements ✅
(primary)
-0.7% [-0.7%, -0.7%] 1
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.1%] 4
All ❌✅ (primary) -0.1% [-0.7%, 0.2%] 3

Max RSS (memory usage)

Results (primary -1.1%, secondary 1.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
5.0% [3.6%, 6.4%] 2
Regressions ❌
(secondary)
3.3% [1.8%, 5.9%] 4
Improvements ✅
(primary)
-4.2% [-5.6%, -1.8%] 4
Improvements ✅
(secondary)
-1.6% [-2.0%, -1.2%] 2
All ❌✅ (primary) -1.1% [-5.6%, 6.4%] 6

Cycles

Results (primary -3.5%, secondary -3.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
4.5% [4.0%, 5.0%] 2
Improvements ✅
(primary)
-3.6% [-8.3%, -1.3%] 115
Improvements ✅
(secondary)
-3.4% [-6.8%, -1.9%] 89
All ❌✅ (primary) -3.5% [-8.3%, 2.4%] 116

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 512.944s -> 515.112s (0.42%)
Artifact size: 398.65 MiB -> 400.60 MiB (0.49%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 4, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

Started perf jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.