Skip to content

fix: Guard SizeSkeleton::compute against stack overflow#156235

Open
rajgandhi1 wants to merge 3 commits intorust-lang:mainfrom
rajgandhi1:compiler_stack_overflow_fix
Open

fix: Guard SizeSkeleton::compute against stack overflow#156235
rajgandhi1 wants to merge 3 commits intorust-lang:mainfrom
rajgandhi1:compiler_stack_overflow_fix

Conversation

@rajgandhi1
Copy link
Copy Markdown

Fixes #156137

Fix: extract the recursion into a private compute_inner that carries a depth counter. When depth exceeds the crate's recursion limit, return LayoutError::Unknown and let the existing transmute size-check produce a normal error instead of crashing.

A regression test is included in tests/ui/transmute/.

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

rustbot commented May 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, types
  • compiler, types expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

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.

Transmuting struct that contains itself causes compiler stack overflow

4 participants