-
Notifications
You must be signed in to change notification settings - Fork 32
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
The RBox SharedStableAbi implementation should have IsNonZeroType == True #36
Comments
The reason I haven't done it yet is because I haven't seen documentation guaranteeing that it has a stable representation across compiler versions. #[repr(C)]
pub struct RBox<T>{
ptr: std::ptr::NonNull<T>,
vtable: *const [T; 0],
}
extern {
pub fn foo(_: RBox<usize>);
pub fn bar(_: Option<RBox<usize>>);
} And the compiler warns with this message:
But this lint is known to have some false positives, so it might actually be ffi-safe. |
Ah, understood. Yeah I think that they are being overly cautious there. After reading the documentation of |
I decided to ask the question in the zulip unsafe-code-guidelines chat ,it looks like it's not guaranteed. |
Ah, thanks for looking further into it, that's a revealing discussion. |
Unless I'm missing something, isn't it the case that
RBox
should haveIsNonZeroType
asTrue
rather thanFalse
?The text was updated successfully, but these errors were encountered: