-
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
Changes from all commits
4664b8b
0757618
7b80726
e2825f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -480,7 +480,15 @@ fn dangling_ptr() -> NonNull<u8> { | |
// SAFETY: ALIGNMENT is a non-zero usize which is then casted | ||
// to a *mut T. Therefore, `ptr` is not null and the conditions for | ||
// calling new_unchecked() are respected. | ||
unsafe { NonNull::new_unchecked(ALIGNMENT as *mut u8) } | ||
#[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) } | ||
} | ||
Comment on lines
+483
to
+491
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
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 |
||
} | ||
|
||
impl<A: ArrowNativeType> Extend<A> for MutableBuffer { | ||
|
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 👀