MCPcopy Create free account
hub / github.com/apache/arrow-rs / dangling_ptr

Function dangling_ptr

arrow-buffer/src/buffer/mutable.rs:856–869  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

854/// This is similar to [`NonNull::dangling`]
855#[inline]
856pub(crate) fn dangling_ptr() -> NonNull<u8> {
857 // SAFETY: ALIGNMENT is a non-zero usize which is then cast
858 // to a *mut u8. Therefore, `ptr` is not null and the conditions for
859 // calling new_unchecked() are respected.
860 #[cfg(miri)]
861 {
862 // Since miri implies a nightly rust version we can use the unstable strict_provenance feature
863 unsafe { NonNull::new_unchecked(std::ptr::without_provenance_mut(ALIGNMENT)) }
864 }
865 #[cfg(not(miri))]
866 {
867 unsafe { NonNull::new_unchecked(ALIGNMENT as *mut u8) }
868 }
869}
870
871impl<A: ArrowNativeType> Extend<A> for MutableBuffer {
872 #[inline]

Callers 3

try_reallocMethod · 0.85
with_capacityMethod · 0.85
from_len_zeroedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected