Skip to content

Fix ICE in ptr_metadata_ty_or_tail for recursive associated types#154884

Open
RaghavenderSingh wants to merge 1 commit intorust-lang:mainfrom
RaghavenderSingh:fix/ptr-metadata-recursive-assoc-type-ice-153431
Open

Fix ICE in ptr_metadata_ty_or_tail for recursive associated types#154884
RaghavenderSingh wants to merge 1 commit intorust-lang:mainfrom
RaghavenderSingh:fix/ptr-metadata-recursive-assoc-type-ice-153431

Conversation

@RaghavenderSingh
Copy link
Copy Markdown

@RaghavenderSingh RaghavenderSingh commented Apr 6, 2026

Fixes #153431.

When a struct's tail field has a recursive associated type, normalization
overflows and normalize_projection_term returns a fresh inference variable
(TyVar) instead of the original alias. This TyVar escapes struct_tail_raw
and reaches ptr_metadata_ty_or_tail, which had no arm for it and called
bug!.

Fix by handling ty::Infer(ty::TyVar(_)) the same way as ty::Error(_),
return Ok(tcx.types.unit) since the overflow error has already been reported.

@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 Apr 6, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 6, 2026

r? @adwinwhite

rustbot has assigned @adwinwhite.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

@rust-log-analyzer

This comment has been minimized.

@RaghavenderSingh RaghavenderSingh force-pushed the fix/ptr-metadata-recursive-assoc-type-ice-153431 branch from c31940d to ca8316f Compare April 6, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: ptr_metadata_ty_or_tail applied to unexpected type

4 participants