-
Notifications
You must be signed in to change notification settings - Fork 892
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
Enable running arrow-array and arrow-arith with miri and avoid strict provenance warning #5387
Conversation
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.
Seems fine to me, though I confess I'm not too across the details of what's exactly happening here(but seems should only affect Miri anyway) 👍
@@ -202,7 +202,7 @@ fn div_rem_word(hi: u64, lo: u64, divisor: u64) -> (u64, u64) { | |||
); | |||
(quot, rem) | |||
} | |||
#[cfg(not(target_arch = "x86_64"))] | |||
#[cfg(any(not(target_arch = "x86_64"), miri))] |
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.
Ah nice 👍
Didn't realize it was this simple change to get Miri working 👀
#[cfg(miri)] | ||
{ | ||
// Since miri implies a nightly rust version we can use the unstable strict_provenance feature | ||
unsafe { NonNull::new_unchecked(std::ptr::invalid_mut(ALIGNMENT)) } | ||
} | ||
#[cfg(not(miri))] | ||
{ | ||
unsafe { NonNull::new_unchecked(ALIGNMENT as *mut u8) } | ||
} |
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.
I'm not as familiar with what's happening here, but I guess as long as it's gated so only affects Miri, should be alright?
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.
invalid_mut
is basically doing the same thing as the cast below, but does not trigger a warning about integer to pointer casts. But it is behind a feature flag and only available on nightly rust.
If you want to go down the rabbit hole of what is pointer provenance, this would be a good point to start: https://github.com/RalfJung/rfcs/blob/provenance/text/0000-rust-has-provenance.md
Cheers 👍 |
Which issue does this PR close?
Noticed this while looking into #614, fixes for parquet crate will be done in a separate PR.
Rationale for this change
What changes are included in this PR?
strict-provenance
feature and avoid a warning when creating buffers with zero capacityAre there any user-facing changes?