Skip to content

Fix the reporting of layout normalization failures in transmute checks - #159456

Open
meta-legend wants to merge 1 commit into
rust-lang:mainfrom
meta-legend:fix-149588
Open

Fix the reporting of layout normalization failures in transmute checks#159456
meta-legend wants to merge 1 commit into
rust-lang:mainfrom
meta-legend:fix-149588

Conversation

@meta-legend

@meta-legend meta-legend commented Jul 17, 2026

Copy link
Copy Markdown

Fixes #149588.

"check_transmute" normalized the source and target types before computing their size skeletons. When that normalization failed, it created a {type error} placeholder and continued into the generic transmute-size diagnostic. This hid the actual layout failure and produced an unhelpful E0512 message.

This changes transmute checking to report the layout normalization failure directly and return early. The diagnostic now explains that rustc cannot determine the layout because the associated type cannot be normalized, instead of showing {type error} as the source type.

I also updated the existing ./tests/ui/layout/normalization-failure.rs test to cover the corrected diagnostic.

@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 Jul 17, 2026
@rustbot

rustbot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @dingxiangfei2009 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

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

@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #160238) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

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.

layout errors in transmute checking don't get emitted

3 participants