Skip to content

Rollup of 9 pull requests - #163605

Closed
JonathanBrouwer wants to merge 21 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-QR3gwZd
Closed

JonathanBrouwer wants to merge 21 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-QR3gwZd

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

mati865 and others added 21 commits September 7, 2026 21:50
Return failed projection obligations from deep normalization instead of
retrying aliases through infallible fallback. Keep regular normalization
recovery by rebuilding projection obligations from the original aliases.
- Introduce `Subdiag::dedup_hash`, which mirrors
  `DiagInner::dedup_hash` and is necessary for the subsequent commits.
- Change the name and structure of `not_yet_emitted` to be clearer.
- Change `retain_mut` to `retain`; mutability isn't required.
Currently deduplication erroneously has no effect with incremental
enabled because the span parent gets included in the hash used for
deduplication.
So it applies the `#[inline]` to every method, not just the first one.
By making it ignore the parent field of spans within the diagnostic.
This is done with a new `DedupHashEncoder` type that uses the existing
`Encoder`/`SpanEncoder` traits to traverse the fields within `DiagInner`
and `Subdiag`.

Fixes rust-lang#162901.
* Name the item that discards an unused type parameter

E0392 pointed at the mention of the parameter with a label saying it
"is likely unused in the containing type", which doesn't say much. It's
unclear what the containing type is meant to be, and we hedge with
"likely" even though we can just go look.

Track the outermost item that throws the argument away while collecting
the usage spans, and name it instead. For ADTs that's a bivariant
parameter in `variances_of`. Type aliases have no variances of their
own, so expand them and check whether the parameter reaches a position
that constrains it -- an alias can mention the parameter and still
discard it by handing it to something else that ignores it. Free
aliases go through `expand_free_alias_tys` rather than `type_of`, since
a diverging one would otherwise recurse forever.

When none of that pins down a culprit, fall back to saying the mention
doesn't constrain the parameter instead of guessing.
* Cover free alias types in the unused type parameter error

A chain of free aliases used to hide the item doing the discarding, and
the same alias applied to different arguments has to be expanded twice
or a use of the parameter goes missing.

The overflow case is worth a test of its own: with a growing argument
there's no repeated alias to spot the divergence with, so the recursion
limit is the only thing that stops the walk.
* Simplify the unused type parameter diagnostic

Variance and associated-type constraints are checked before this
diagnostic runs. Restore the span collector and use a definite label
without identifying which wrapper discards the parameter.

Update the diagnostic expectations and test comments accordingly.
…Brouwer

Improve diagnostic deduplication

Diagnostic deduplication currently considers `Span::parent`, which can lead to some surprising results. Details in individual commits.

Fixes rust-lang#106571.
Fixes rust-lang#162901.

r? @JonathanBrouwer
…enton

windows-gnu: enable native TLS

Since Rust 1.98 we have declared minimal supported versions for the tools like the linker. That means native TLS is supposed to work now as seen in try builds in: rust-lang#156819
Therefore, this change is very likely to cause issues if somebody still doesn't adhere to the requirements. As such I don't know what form of approval will be required.

Fixes rust-lang#91659
Fixes rust-lang#135719
…ame_discarding_item, r=fmease

wfcheck: name the item that discards an unused type parameter

fixes rust-lang#161365

label was "`T` is named here, but is likely unused in the containing type". the "likely" is the part that bugs me. we can just go look, so now it does:

```
LL |     bar: Bar<T>,
   |              - `T` is named here, but `Bar` does not use it
```

while collecting the usage spans it holds on to the outermost thing that throws the argument away. adts are easy, bivariant param in variances_of. aliases have no variances so you expand them and see what's left, and my first version of that only looked for the param in the rhs, which is wrong. `type Alias<T> = DropFirst<T, u8>` mentions T and still drops it. so it walks the expansion skipping bivariant slots. (nested args blame the outer one, `Bar<Vec<T>>` points at Bar.) if it can't work out who's responsible it falls back to "this does not constrain `T`".

warning for whoever touches this next: type_of doesn't expand free aliases and you can't chase them yourself. `type Recur<T> = Recur<(T,)>` never repeats its args so there's nothing to stop on, stack goes. expand_free_alias_tys is the one with the limit. variance-overflow.rs has a comment at the top saying exactly this and i wrote it wrong anyway, so i stuck a case in there for the diagnostic path.

tests in variance-unused-type-param.rs, new file for alias chains.

there's a separate bug in the "only used recursively" branch right next to this one that i left alone, wrote up why in a comment.
…normalization_failure, r=lcnr

trait_selection: Preserve eager normalization failures

Fixes rust-lang#160875

This started from rust-lang#161407 and the Zulip discussion around eager normalization failures.

The nested inherent associated type case takes two paths. Eager normalization handles the inner alias first, then the outer alias fails the leak check. The old fallback throws that attempt away and retries the original aliases. That retry can succeed because the lifetime constraints come back through nested goals and the parent leak check does not see them.

My first take was to resolve the inference variable after fulfillment. That made the debug assertion go away, but it was only hiding the failed relation. I do not think we should return a value from a path that already failed the leak check.

`normalize_with_universes` now returns the failed obligation. Deep normalization passes that failure back instead of falling into recovery. Regular `normalize` stays infallible and keeps the fallback behavior because its callers already expect obligations.

The fallback still has to rebuild those obligations. For higher ranked aliases, `ReplaceAliasWithInfer` leaves the alias in the folded value, replaces bound vars with placeholders only for the `Projection` obligation, and does not put the fresh inference term in the returned type. I missed that part in my first version and dropped too much.

I think this is the cleanest split. Deep normalization gets the strict behavior it promises, while regular normalization still recovers in the same general way as before.

The UI tests cover the nested IAT case and the affected diagnostics.
Avoid computing overflowed goal chains for crate dependencies

The `RECURSION_DEPTH_EXCEEDING_LIMIT` FCW is quite wasteful w.r.t compilation time and max rss because we only emit one diagnostic per crate while we compute overflowed goal chain for each overflowed goal. [discussion on zulip](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/bevy_render-0.2E19.2E1/near/624809785)

We can mitigate that a lot by not computing goal chains for dependencies which don't emit warnings by default.
…t-methods, r=Urgau

[rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods

Needed for rust-lang#162808.
First commit comes from rust-lang#163133.

This is more of a hack than a proper fix as I don't think there is a better way to handle this. So in short:

 * If a primitive incoherent impl method is implemented outside of `core`/`alloc`/`std`, we don't link to it.
 * If in `alloc`/`std`, we link to `std`

r? @Urgau
…oli-obk

GVN transmutes of Immediate::Uninit to Immediate::Uninit

This makes us generate the intended MIR for rust-lang#159454.
…larfonthey

Make `AllocatorNightly` less clever

r? nia-e
…ark-Simulacrum

Add union pattern reference change to relnotes
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Oct 1, 2026
@rustbot rustbot added 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 1, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5 force

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

@rust-bors

rust-bors Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 96f3cd5 has been approved by JonathanBrouwer

It is now in the queue for this repository.

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 1, 2026
Rollup of 9 pull requests


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

rust-bors Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Testing commit 96f3cd5 with merge c546f2e...

Workflow: https://github.com/rust-lang/rust/actions/runs/36883099799

rust-bors Bot pushed a commit that referenced this pull request Oct 1, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163461 (Improve diagnostic deduplication)
 - #159021 (windows-gnu: enable native TLS)
 - #161467 (wfcheck: name the item that discards an unused type parameter)
 - #162618 (trait_selection: Preserve eager normalization failures)
 - #163064 (Avoid computing overflowed goal chains for crate dependencies)
 - #163360 ([rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods)
 - #163385 (GVN transmutes of Immediate::Uninit to Immediate::Uninit)
 - #163590 (Make `AllocatorNightly` less clever)
 - #163599 (Add union pattern reference change to relnotes)
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 1, 2026
@rust-bors

rust-bors Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

Auto build was cancelled due to the PR being closed. Cancelled workflows:

@rust-bors

rust-bors Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: dcf81d5 (dcf81d53def3ccadd01cb2ec536a958341fbe7dd)
Base parent: 837b18a (837b18aae097503892d7aab6c7ddce332a991a21)

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

Labels

rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants