Skip to content

Conversation

compiler-errors
Copy link
Member

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 #94149

r? @michaelwoerister since you touched this code last, I think!

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 22, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2022
@rust-log-analyzer

This comment has been minimized.

@michaelwoerister
Copy link
Member

Interesting! I'll take a closer look shortly.

Copy link
Member

@michaelwoerister michaelwoerister left a 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());
Copy link
Member

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

Copy link
Member

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.

@michaelwoerister
Copy link
Member

Also, please squash the commits.

@compiler-errors compiler-errors force-pushed the fat-uninhabitable-pointer branch from 4eb6996 to c73a2f8 Compare February 23, 2022 16:20
@michaelwoerister
Copy link
Member

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Feb 24, 2022

📌 Commit c73a2f8 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 24, 2022
@bors
Copy link
Collaborator

bors commented Feb 24, 2022

⌛ Testing commit c73a2f8 with merge a737eace9493f872ef78cc8014b3f542e4131c8d...

@bors
Copy link
Collaborator

bors commented Feb 24, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 24, 2022
@Mark-Simulacrum
Copy link
Member

@bors retry (crates.io down)

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 24, 2022
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 24, 2022
…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!
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 24, 2022
…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!
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 24, 2022
…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!
This was referenced Feb 24, 2022
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2022
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
@bors bors merged commit 6b03a46 into rust-lang:master Feb 25, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 25, 2022
@compiler-errors compiler-errors deleted the fat-uninhabitable-pointer branch April 7, 2022 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

debug assertion failed: debug_assert_eq!((thin_pointer_size, thin_pointer_align), cx.size_and_align_of(ptr_type));
7 participants