-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Mark ZST as FFI-safe if all its fields are PhantomData #106675
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
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.
This is a good start, thanks for the contribution, left some comments below.
@rustbot author (use |
0272d23
to
27c5684
Compare
I think the new version takes into account your points 2 and 3, and I answered 1 above. LMKWYT |
27c5684
to
50b53ca
Compare
@rustbot ready |
50b53ca
to
f5ab431
Compare
There's a test failing, after you fix that then I can approve :) |
This is a bit above my pay-grade: The test failing is basically: #[repr(transparent)]
enum TransparentEnum<T> {
Variant(T, std::marker::PhantomData<Z>),
} which fails because it is an enum with a PhantomData, triggering this code path I'm not sure which one is the correct behavior. Should it have been considered not FFI safe since the beginning, or is this PR introducing a new false positive? |
I've pushed a fix for the failing test but I'll leave it to you to decide which is the correct behavior. @rustbot ready |
It this is ok for you, I guess all is left is for me to squash that into a single commit and mark the PR as not draft. |
Works for me :) |
1722028
to
574a31f
Compare
Looks like we're good to go! |
In fact, one last thing, can you add a test case for #106629? |
574a31f
to
27a4e17
Compare
My bad, I also forgot to do it! |
Tests were moved from |
Modify the linting behavior and add the corresponding regression test
27a4e17
to
797f247
Compare
@bors r+ |
Rollup of 8 pull requests Successful merges: - rust-lang#105795 (Stabilize `abi_efiapi` feature) - rust-lang#106446 ([LSDA] Take ttype_index into account when taking unwind action) - rust-lang#106675 (Mark ZST as FFI-safe if all its fields are PhantomData) - rust-lang#106740 (Adding a hint on iterator type errors) - rust-lang#106741 (Fix reexport of `doc(hidden)` item) - rust-lang#106759 (Revert "Make nested RPITIT inherit the parent opaque's generics.") - rust-lang#106772 (Re-add mw to review rotation) - rust-lang#106778 (Exclude formatting commit from blame) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This presents one possible solution to issue: #106629.
This is my first (tentative) contribution to the compiler itself.
I'm looking forward for comments and feedback
Closes: #106629