-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
properly handle fat pointers to uninhabitable types #94242
properly handle fat pointers to uninhabitable types #94242
Conversation
This comment has been minimized.
This comment has been minimized.
Interesting! I'll take a closer look shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @compiler-errors! Looks great. I'll be happy to r+ with the comments below addressed.
@@ -437,19 +438,23 @@ fn pointer_or_reference_metadata<'ll, 'tcx>( | |||
unique_type_id: UniqueTypeId, | |||
) -> MetadataCreationResult<'ll> { | |||
let pointee_type_metadata = type_metadata(cx, pointee_type); | |||
let pointee_tail_type = cx.tcx.struct_tail_erasing_lifetimes(pointee_type, cx.param_env()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this into fat_pointer_kind()
? Then users of that function don't have to know about struct_tail_erasing_lifetimes()
.
@@ -0,0 +1,28 @@ | |||
// check-pass | |||
// compile-flags: -Cdebuginfo=2 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment that this fixes #94149.
Also, please squash the commits. |
4eb6996
to
c73a2f8
Compare
Thanks! |
📌 Commit c73a2f8 has been approved by |
⌛ Testing commit c73a2f8 with merge a737eace9493f872ef78cc8014b3f542e4131c8d... |
💔 Test failed - checks-actions |
@bors retry (crates.io down) |
…ointer, r=michaelwoerister properly handle fat pointers to uninhabitable types Calculate the pointee metadata size by using `tcx.struct_tail_erasing_lifetimes` instead of duplicating the logic in `fat_pointer_kind`. Open to alternatively suggestions on how to fix this. Fixes rust-lang#94149 r? `@michaelwoerister` since you touched this code last, I think!
…ointer, r=michaelwoerister properly handle fat pointers to uninhabitable types Calculate the pointee metadata size by using `tcx.struct_tail_erasing_lifetimes` instead of duplicating the logic in `fat_pointer_kind`. Open to alternatively suggestions on how to fix this. Fixes rust-lang#94149 r? ``@michaelwoerister`` since you touched this code last, I think!
…ointer, r=michaelwoerister properly handle fat pointers to uninhabitable types Calculate the pointee metadata size by using `tcx.struct_tail_erasing_lifetimes` instead of duplicating the logic in `fat_pointer_kind`. Open to alternatively suggestions on how to fix this. Fixes rust-lang#94149 r? ```@michaelwoerister``` since you touched this code last, I think!
Rollup of 9 pull requests Successful merges: - rust-lang#91795 (resolve/metadata: Stop encoding macros as reexports) - rust-lang#93714 (better ObligationCause for normalization errors in `can_type_implement_copy`) - rust-lang#94175 (Improve `--check-cfg` implementation) - rust-lang#94212 (Stop manually SIMDing in `swap_nonoverlapping`) - rust-lang#94242 (properly handle fat pointers to uninhabitable types) - rust-lang#94308 (Normalize main return type during mono item collection & codegen) - rust-lang#94315 (update auto trait lint for `PhantomData`) - rust-lang#94316 (Improve string literal unescaping) - rust-lang#94327 (Avoid emitting full macro body into JSON errors) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Calculate the pointee metadata size by using
tcx.struct_tail_erasing_lifetimes
instead of duplicating the logic infat_pointer_kind
. Open to alternatively suggestions on how to fix this.Fixes #94149
r? @michaelwoerister since you touched this code last, I think!