You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #1592 a zero-sized array was introduced to fix alignment issues for accessing incomplete arrays. My question is: Why does the PhantomData still get generated ? Shouldn't the zero-sized array + repr(C) already fix this ? Or could rustc still remove the whole thing without PhantomData ? Another obvious answer is obviously that it's just always generated and we don't need it for this case, as there are no lifetimes involved we might want to bind somewhere.
So this should be enough from my PoV:
/*..*/pubstruct__IncompleteArrayField([u8;0]);
This is more a question about why and whether bindgen knows something I don't, so I maybe should adopt what bindgen does.
The text was updated successfully, but these errors were encountered:
0xpr03
changed the title
Reason for PhantomData on incomplete Arrays without lifetimes
Reason for PhantomData on incomplete arrays without lifetimes
Mar 6, 2023
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
This is borrowing the example from #1359.
In #1592 a zero-sized array was introduced to fix alignment issues for accessing incomplete arrays. My question is: Why does the
PhantomData
still get generated ? Shouldn't the zero-sized array +repr(C)
already fix this ? Or could rustc still remove the whole thing without PhantomData ? Another obvious answer is obviously that it's just always generated and we don't need it for this case, as there are no lifetimes involved we might want to bind somewhere.So this should be enough from my PoV:
This is more a question about why and whether bindgen knows something I don't, so I maybe should adopt what bindgen does.
The text was updated successfully, but these errors were encountered: