Fix the reporting of layout normalization failures in transmute checks - #159456
Fix the reporting of layout normalization failures in transmute checks#159456meta-legend wants to merge 1 commit into
Conversation
|
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 (
Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
r=me after rebase |
|
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. |
|
@rustbot review |
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.