Fix warning about unused method (#3488)

fix warning about unused method
This commit is contained in:
Dustin J. Mitchell 2024-06-14 22:15:21 -04:00 committed by GitHub
parent bba010c307
commit 161463deec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -83,7 +83,7 @@ pub(crate) trait PassByPointer: Sized {
/// # Safety /// # Safety
/// ///
/// - arg must not be NULL /// - arg must not be NULL
/// - arg must be a value returned from Box::into_raw (via return_ptr or ptr_to_arg_out) /// - arg must be a value returned from Box::into_raw (via return_ptr)
/// - arg becomes invalid and must not be used after this call /// - arg becomes invalid and must not be used after this call
unsafe fn take_from_ptr_arg(arg: *mut Self) -> Self { unsafe fn take_from_ptr_arg(arg: *mut Self) -> Self {
debug_assert!(!arg.is_null()); debug_assert!(!arg.is_null());
@ -127,19 +127,6 @@ pub(crate) trait PassByPointer: Sized {
unsafe fn return_ptr(self) -> *mut Self { unsafe fn return_ptr(self) -> *mut Self {
Box::into_raw(Box::new(self)) Box::into_raw(Box::new(self))
} }
/// Return a value to C, transferring ownership, via an "output parameter".
///
/// # Safety
///
/// - the caller must ensure that the value is eventually freed
/// - arg_out must not be NULL
/// - arg_out must point to valid, properly aligned memory for a pointer value
unsafe fn ptr_to_arg_out(self, arg_out: *mut *mut Self) {
debug_assert!(!arg_out.is_null());
// SAFETY: see docstring
unsafe { *arg_out = self.return_ptr() };
}
} }
/// Support for C lists of objects referenced by value. /// Support for C lists of objects referenced by value.