add Safety section to roc_box as_refcount_ptr()

This commit is contained in:
Luke Boswell 2024-12-02 14:31:19 +11:00
parent badba1d9c0
commit 89ce3d61d8
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0

View file

@ -76,6 +76,10 @@ where
/// The raw pointer to a roc box, including the leading refcount
/// Intended for use by platforms in roc_dealloc
///
/// # Safety
///
/// Returns a raw pointer to the roc box
pub unsafe fn as_refcount_ptr(&self) -> *mut c_void {
let alignment = Self::alloc_alignment();
let with_offset = unsafe { self.contents.as_ptr().cast::<u8>().sub(alignment) };