Skip to content

Fix too-short variance slice in variances_of cycle recovery#158163

Open
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:fix-variances-cycle-recovery-count
Open

Fix too-short variance slice in variances_of cycle recovery#158163
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:fix-variances-cycle-recovery-count

Conversation

@xmakro

@xmakro xmakro commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

This changes the cycle-error fallback in variances_of to size the slice the same way the provider does in variance/solve.rs:117.

This can otherwise ICE under the parallel frontend in relate_args_with_variances for items that inherit their generics from a parent (like a tuple struct constructor). See #154560 (comment)

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. labels Jun 20, 2026
@petrochenkov petrochenkov self-assigned this Jun 22, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

(Please un-draft the PR and mark it as waiting on review when you think it's ready.)

@xmakro xmakro marked this pull request as ready for review June 26, 2026 15:33
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 26, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c2c6cb4 has been approved by petrochenkov

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1. This pull request will be tested once the tree is reopened.

@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 Jun 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 27, 2026
…y-count, r=petrochenkov

Fix too-short variance slice in `variances_of` cycle recovery

This changes the cycle-error fallback in `variances_of` to size the slice the same way the provider does in [`variance/solve.rs:117`](https://github.com/rust-lang/rust/blob/32ea3615cc027bcb8fd720c7511ffb484f6223a3/compiler/rustc_hir_analysis/src/variance/solve.rs#L117).

This can otherwise ICE under the parallel frontend in `relate_args_with_variances` for items that inherit their generics from a parent (like a tuple struct constructor). See rust-lang#154560 (comment)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 27, 2026
…y-count, r=petrochenkov

Fix too-short variance slice in `variances_of` cycle recovery

This changes the cycle-error fallback in `variances_of` to size the slice the same way the provider does in [`variance/solve.rs:117`](https://github.com/rust-lang/rust/blob/32ea3615cc027bcb8fd720c7511ffb484f6223a3/compiler/rustc_hir_analysis/src/variance/solve.rs#L117).

This can otherwise ICE under the parallel frontend in `relate_args_with_variances` for items that inherit their generics from a parent (like a tuple struct constructor). See rust-lang#154560 (comment)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 28, 2026
…y-count, r=petrochenkov

Fix too-short variance slice in `variances_of` cycle recovery

This changes the cycle-error fallback in `variances_of` to size the slice the same way the provider does in [`variance/solve.rs:117`](https://github.com/rust-lang/rust/blob/32ea3615cc027bcb8fd720c7511ffb484f6223a3/compiler/rustc_hir_analysis/src/variance/solve.rs#L117).

This can otherwise ICE under the parallel frontend in `relate_args_with_variances` for items that inherit their generics from a parent (like a tuple struct constructor). See rust-lang#154560 (comment)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 28, 2026
…y-count, r=petrochenkov

Fix too-short variance slice in `variances_of` cycle recovery

This changes the cycle-error fallback in `variances_of` to size the slice the same way the provider does in [`variance/solve.rs:117`](https://github.com/rust-lang/rust/blob/32ea3615cc027bcb8fd720c7511ffb484f6223a3/compiler/rustc_hir_analysis/src/variance/solve.rs#L117).

This can otherwise ICE under the parallel frontend in `relate_args_with_variances` for items that inherit their generics from a parent (like a tuple struct constructor). See rust-lang#154560 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

3 participants