Skip to content

Avoid ICE on None from prepare_vtable_segments - #164476

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lsunsi:issue153368
Oct 29, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lsunsi:issue153368

Conversation

@lsunsi

@lsunsi lsunsi commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Closes #153368

I actually just realized None caused the ICE and None was semantic for the caller, meaning I could just propagate the None instead of unwrapping and to my surprised ICE is fixed and no test is broken!

The issue here is that I'm not sure the implications of changing this signature, but it seems to work fine.

r? trait-system-refactor-initiative

@rustbot

rustbot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@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. labels Oct 17, 2026
@rustbot

rustbot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Error: Failed to set assignee to trait-system-refactor-initiative: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@lsunsi

lsunsi commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Oct 17, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_middle/src/queries.rs Resolved
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 23, 2026
@rustbot

rustbot commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@oli-obk

oli-obk commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Avoid ICE on None from prepare_vtable_segments
@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f5b086f (f5b086fc35e8f0a0ecae4a835a11d0092a00fb2f)
Base parent: 0cefa27 (0cefa27fe3deee26fc98ee44249406358d9f0d26)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f5b086f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary -0.3%, secondary -0.5%)

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

mean range count
Regressions ❌
(primary)
1.1% [0.5%, 2.2%] 5
Regressions ❌
(secondary)
2.5% [1.8%, 3.1%] 2
Improvements ✅
(primary)
-1.3% [-5.8%, -0.4%] 8
Improvements ✅
(secondary)
-1.5% [-3.0%, -0.7%] 6
All ❌✅ (primary) -0.3% [-5.8%, 2.2%] 13

Cycles

Results (primary -0.0%, secondary -0.7%)

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

mean range count
Regressions ❌
(primary)
0.8% [0.4%, 1.3%] 7
Regressions ❌
(secondary)
1.3% [0.6%, 2.0%] 4
Improvements ✅
(primary)
-0.9% [-1.5%, -0.5%] 6
Improvements ✅
(secondary)
-1.6% [-3.5%, -0.6%] 8
All ❌✅ (primary) -0.0% [-1.5%, 1.3%] 13

Binary size

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

Bootstrap: 487.555s -> 487.967s (0.08%)
Artifact size: 406.51 MiB -> 406.53 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 23, 2026
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

🔨 4 commits were squashed into 8443ca7.

@oli-obk oli-obk left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 8443ca7 has been tentatively approved by oli-obk

It will be put into the queue for this repository once PR CI succeeds.

@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 28, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 28, 2026
Avoid ICE on None from prepare_vtable_segments

Closes rust-lang#153368

I actually just realized None caused the ICE and None was semantic for the caller, meaning I could just propagate the None instead of unwrapping and to my surprised ICE is fixed and no test is broken!

The issue here is that I'm not sure the implications of changing this signature, but it seems to work fine.

r? trait-system-refactor-initiative
rust-bors Bot pushed a commit that referenced this pull request Oct 28, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #165032 (stdarch subtree update)
 - #165072 (Submodule update of rustc-perf)
 - #144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - #162342 (More stdarch regression tests)
 - #163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - #164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - #164916 (CI: rfl: move job forward to Linux v7.3)
 - #164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - #165083 (Gate `z` inline asm template modifier)
 - #165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - #161131 (Check associated const binding types)
 - #161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - #164315 (make powerpc `Complex` ABI GCC-compatible)
 - #164476 (Avoid ICE on None from prepare_vtable_segments)
 - #164981 (Reflection add TypeId::name)
 - #165003 (follow up for global-alloc-reentry test)
 - #165020 (Bless mir-opt panic-abort tests)
 - #165066 (skip max_repr_align in Layout::eq_abi)
 - #165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - #165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - #165082 (Remove stability note from `rust_splat`)
rust-bors Bot pushed a commit that referenced this pull request Oct 29, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #165032 (stdarch subtree update)
 - #165072 (Submodule update of rustc-perf)
 - #144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - #162342 (More stdarch regression tests)
 - #163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - #164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - #164916 (CI: rfl: move job forward to Linux v7.3)
 - #164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - #165083 (Gate `z` inline asm template modifier)
 - #165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - #161131 (Check associated const binding types)
 - #161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - #164315 (make powerpc `Complex` ABI GCC-compatible)
 - #164476 (Avoid ICE on None from prepare_vtable_segments)
 - #164981 (Reflection add TypeId::name)
 - #165003 (follow up for global-alloc-reentry test)
 - #165020 (Bless mir-opt panic-abort tests)
 - #165066 (skip max_repr_align in Layout::eq_abi)
 - #165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - #165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - #165082 (Remove stability note from `rust_splat`)
rust-bors Bot pushed a commit that referenced this pull request Oct 29, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #165032 (stdarch subtree update)
 - #165072 (Submodule update of rustc-perf)
 - #144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - #162342 (More stdarch regression tests)
 - #163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - #164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - #164916 (CI: rfl: move job forward to Linux v7.3)
 - #164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - #165083 (Gate `z` inline asm template modifier)
 - #165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - #161131 (Check associated const binding types)
 - #161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - #164315 (make powerpc `Complex` ABI GCC-compatible)
 - #164476 (Avoid ICE on None from prepare_vtable_segments)
 - #164981 (Reflection add TypeId::name)
 - #165003 (follow up for global-alloc-reentry test)
 - #165020 (Bless mir-opt panic-abort tests)
 - #165066 (skip max_repr_align in Layout::eq_abi)
 - #165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - #165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - #165082 (Remove stability note from `rust_splat`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 29, 2026
Avoid ICE on None from prepare_vtable_segments

Closes rust-lang#153368

I actually just realized None caused the ICE and None was semantic for the caller, meaning I could just propagate the None instead of unwrapping and to my surprised ICE is fixed and no test is broken!

The issue here is that I'm not sure the implications of changing this signature, but it seems to work fine.

r? trait-system-refactor-initiative
rust-bors Bot pushed a commit that referenced this pull request Oct 29, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #165032 (stdarch subtree update)
 - #165072 (Submodule update of rustc-perf)
 - #144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - #162342 (More stdarch regression tests)
 - #163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - #164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - #164916 (CI: rfl: move job forward to Linux v7.3)
 - #164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - #165083 (Gate `z` inline asm template modifier)
 - #165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - #165123 (Temporarily drop macos-26 jobs)
 - #161131 (Check associated const binding types)
 - #161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - #164315 (make powerpc `Complex` ABI GCC-compatible)
 - #164476 (Avoid ICE on None from prepare_vtable_segments)
 - #164981 (Reflection add TypeId::name)
 - #165003 (follow up for global-alloc-reentry test)
 - #165020 (Bless mir-opt panic-abort tests)
 - #165066 (skip max_repr_align in Layout::eq_abi)
 - #165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - #165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - #165082 (Remove stability note from `rust_splat`)
rust-bors Bot pushed a commit that referenced this pull request Oct 29, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #165032 (stdarch subtree update)
 - #165072 (Submodule update of rustc-perf)
 - #144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - #162342 (More stdarch regression tests)
 - #163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - #164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - #164916 (CI: rfl: move job forward to Linux v7.3)
 - #164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - #165083 (Gate `z` inline asm template modifier)
 - #165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - #165123 (Temporarily drop macos-26 jobs)
 - #161131 (Check associated const binding types)
 - #161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - #164315 (make powerpc `Complex` ABI GCC-compatible)
 - #164476 (Avoid ICE on None from prepare_vtable_segments)
 - #164981 (Reflection add TypeId::name)
 - #165003 (follow up for global-alloc-reentry test)
 - #165020 (Bless mir-opt panic-abort tests)
 - #165066 (skip max_repr_align in Layout::eq_abi)
 - #165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - #165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - #165082 (Remove stability note from `rust_splat`)
rust-bors Bot pushed a commit that referenced this pull request Oct 29, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #165032 (stdarch subtree update)
 - #165123 (Temporarily drop macos-26 jobs)
 - #165072 (Submodule update of rustc-perf)
 - #144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - #162342 (More stdarch regression tests)
 - #163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - #164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - #164916 (CI: rfl: move job forward to Linux v7.3)
 - #164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - #165083 (Gate `z` inline asm template modifier)
 - #165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - #161131 (Check associated const binding types)
 - #161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - #164315 (make powerpc `Complex` ABI GCC-compatible)
 - #164476 (Avoid ICE on None from prepare_vtable_segments)
 - #165003 (follow up for global-alloc-reentry test)
 - #165020 (Bless mir-opt panic-abort tests)
 - #165066 (skip max_repr_align in Layout::eq_abi)
 - #165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - #165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - #165082 (Remove stability note from `rust_splat`)
@rust-bors
rust-bors Bot merged commit 71aca69 into rust-lang:main Oct 29, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 29, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 29, 2026
Rollup merge of #164476 - lsunsi:issue153368, r=oli-obk

Avoid ICE on None from prepare_vtable_segments

Closes #153368

I actually just realized None caused the ICE and None was semantic for the caller, meaning I could just propagate the None instead of unwrapping and to my surprised ICE is fixed and no test is broken!

The issue here is that I'm not sure the implications of changing this signature, but it seems to work fine.

r? trait-system-refactor-initiative
hashcatHitman pushed a commit to hashcatHitman/miri that referenced this pull request Oct 30, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#165032 (stdarch subtree update)
 - rust-lang/rust#165123 (Temporarily drop macos-26 jobs)
 - rust-lang/rust#165072 (Submodule update of rustc-perf)
 - rust-lang/rust#144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - rust-lang/rust#162342 (More stdarch regression tests)
 - rust-lang/rust#163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - rust-lang/rust#164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - rust-lang/rust#164916 (CI: rfl: move job forward to Linux v7.3)
 - rust-lang/rust#164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - rust-lang/rust#164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - rust-lang/rust#165083 (Gate `z` inline asm template modifier)
 - rust-lang/rust#165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - rust-lang/rust#161131 (Check associated const binding types)
 - rust-lang/rust#161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - rust-lang/rust#164315 (make powerpc `Complex` ABI GCC-compatible)
 - rust-lang/rust#164476 (Avoid ICE on None from prepare_vtable_segments)
 - rust-lang/rust#165003 (follow up for global-alloc-reentry test)
 - rust-lang/rust#165020 (Bless mir-opt panic-abort tests)
 - rust-lang/rust#165066 (skip max_repr_align in Layout::eq_abi)
 - rust-lang/rust#165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - rust-lang/rust#165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - rust-lang/rust#165082 (Remove stability note from `rust_splat`)
@lsunsi
lsunsi deleted the issue153368 branch October 30, 2026 10:36
jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 31, 2026
…ethod-vtable-slot, r=oli-obk

Improve delayed bug comment and message on first_method_vtable_slot

This PR follows from rust-lang#164476.
It's just a leftover improvement so that the bug mirrors a similar case in https://github.com/lsunsi/rust/blob/92b5b8c87c61b20adc9001b41baf587634a74734/compiler/rustc_trait_selection/src/traits/vtable.rs#L441.

---

Following @oli-obk suggestion I tried looking for other approaches in order to avoid the None and add the `unwrap` back. The main one would be to short-circuit the `first_method_vtable_slot` call by short-circuiting up the call stack when an error or taint is found.

In that sense I realized the callstack is roughtly `is_recursive_terminator > ... > resolve_instance_raw > ... > resolve_associated_item > ... > first_method_vtable_slot` when we reach the previous ICE, which doesn't lead much space for that idea.

Further, since `trait_ref.has_non_region_infer() || trait_ref.has_non_region_param()` is being checked in order to avoid this exact `first_method_vtable_slot` call, I thought maybe we could have another `trait_ref` property that could be used in the same way for our specific test case.

Upon checking most of the `has_` methods and `error_reported` I saw nothing useful, which seems to lead to the conclusion that the previous fix was good enough.

Then I just resorted to copying the comment from a similar place with similar behavior to the place I added the delayed bug previously.

r? @oli-obk
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 31, 2026
…ethod-vtable-slot, r=oli-obk

Improve delayed bug comment and message on first_method_vtable_slot

This PR follows from rust-lang#164476.
It's just a leftover improvement so that the bug mirrors a similar case in https://github.com/lsunsi/rust/blob/92b5b8c87c61b20adc9001b41baf587634a74734/compiler/rustc_trait_selection/src/traits/vtable.rs#L441.

---

Following @oli-obk suggestion I tried looking for other approaches in order to avoid the None and add the `unwrap` back. The main one would be to short-circuit the `first_method_vtable_slot` call by short-circuiting up the call stack when an error or taint is found.

In that sense I realized the callstack is roughtly `is_recursive_terminator > ... > resolve_instance_raw > ... > resolve_associated_item > ... > first_method_vtable_slot` when we reach the previous ICE, which doesn't lead much space for that idea.

Further, since `trait_ref.has_non_region_infer() || trait_ref.has_non_region_param()` is being checked in order to avoid this exact `first_method_vtable_slot` call, I thought maybe we could have another `trait_ref` property that could be used in the same way for our specific test case.

Upon checking most of the `has_` methods and `error_reported` I saw nothing useful, which seems to lead to the conclusion that the previous fix was good enough.

Then I just resorted to copying the comment from a similar place with similar behavior to the place I added the delayed bug previously.

r? @oli-obk
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 31, 2026
…ethod-vtable-slot, r=oli-obk

Improve delayed bug comment and message on first_method_vtable_slot

This PR follows from rust-lang#164476.
It's just a leftover improvement so that the bug mirrors a similar case in https://github.com/lsunsi/rust/blob/92b5b8c87c61b20adc9001b41baf587634a74734/compiler/rustc_trait_selection/src/traits/vtable.rs#L441.

---

Following @oli-obk suggestion I tried looking for other approaches in order to avoid the None and add the `unwrap` back. The main one would be to short-circuit the `first_method_vtable_slot` call by short-circuiting up the call stack when an error or taint is found.

In that sense I realized the callstack is roughtly `is_recursive_terminator > ... > resolve_instance_raw > ... > resolve_associated_item > ... > first_method_vtable_slot` when we reach the previous ICE, which doesn't lead much space for that idea.

Further, since `trait_ref.has_non_region_infer() || trait_ref.has_non_region_param()` is being checked in order to avoid this exact `first_method_vtable_slot` call, I thought maybe we could have another `trait_ref` property that could be used in the same way for our specific test case.

Upon checking most of the `has_` methods and `error_reported` I saw nothing useful, which seems to lead to the conclusion that the previous fix was good enough.

Then I just resorted to copying the comment from a similar place with similar behavior to the place I added the delayed bug previously.

r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Oct 31, 2026
Rollup merge of #165190 - lsunsi:improve-delayed-bug-first-method-vtable-slot, r=oli-obk

Improve delayed bug comment and message on first_method_vtable_slot

This PR follows from #164476.
It's just a leftover improvement so that the bug mirrors a similar case in https://github.com/lsunsi/rust/blob/92b5b8c87c61b20adc9001b41baf587634a74734/compiler/rustc_trait_selection/src/traits/vtable.rs#L441.

---

Following @oli-obk suggestion I tried looking for other approaches in order to avoid the None and add the `unwrap` back. The main one would be to short-circuit the `first_method_vtable_slot` call by short-circuiting up the call stack when an error or taint is found.

In that sense I realized the callstack is roughtly `is_recursive_terminator > ... > resolve_instance_raw > ... > resolve_associated_item > ... > first_method_vtable_slot` when we reach the previous ICE, which doesn't lead much space for that idea.

Further, since `trait_ref.has_non_region_infer() || trait_ref.has_non_region_param()` is being checked in order to avoid this exact `first_method_vtable_slot` call, I thought maybe we could have another `trait_ref` property that could be used in the same way for our specific test case.

Upon checking most of the `has_` methods and `error_reported` I saw nothing useful, which seems to lead to the conclusion that the previous fix was good enough.

Then I just resorted to copying the comment from a similar place with similar behavior to the place I added the delayed bug previously.

r? @oli-obk
BenMac31 pushed a commit to graphide-oss/rust-analyzer that referenced this pull request Nov 2, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#165032 (stdarch subtree update)
 - rust-lang/rust#165123 (Temporarily drop macos-26 jobs)
 - rust-lang/rust#165072 (Submodule update of rustc-perf)
 - rust-lang/rust#144090 (Make `IoSlice` and `IoSliceMut` methods unstably const)
 - rust-lang/rust#162342 (More stdarch regression tests)
 - rust-lang/rust#163909 (std: Test the exit behavior of `abort` and `abort_immediate`)
 - rust-lang/rust#164766 (Unstably introduce MVP edition migration lint `unmarked_unchecked_type_aliases` together with bikeshed attribute `#[rustc_unchecked_type_alias]`)
 - rust-lang/rust#164916 (CI: rfl: move job forward to Linux v7.3)
 - rust-lang/rust#164924 (Remove `TypeKind` from `rustc_codegen_ssa`)
 - rust-lang/rust#164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
 - rust-lang/rust#165083 (Gate `z` inline asm template modifier)
 - rust-lang/rust#165087 (Fix flaky CI test `named_temp_file_new_creates_file`)
 - rust-lang/rust#161131 (Check associated const binding types)
 - rust-lang/rust#161418 (give next-solver's `evaluate_const` its own `try_evaluate_const` logic)
 - rust-lang/rust#164315 (make powerpc `Complex` ABI GCC-compatible)
 - rust-lang/rust#164476 (Avoid ICE on None from prepare_vtable_segments)
 - rust-lang/rust#165003 (follow up for global-alloc-reentry test)
 - rust-lang/rust#165020 (Bless mir-opt panic-abort tests)
 - rust-lang/rust#165066 (skip max_repr_align in Layout::eq_abi)
 - rust-lang/rust#165080 (Syntactically allow C-variadics in parenthesized argument lists)
 - rust-lang/rust#165081 (move `#[rustc_allow_const_fn_unstable]` attr check to attr parsing stage)
 - rust-lang/rust#165082 (Remove stability note from `rust_splat`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. T-types Relevant to the types team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: prepare_vtable_segments() is None

5 participants