Change mem::forget to ManuallyDrop
MODIFY
src/manual/core/ptr.rs
src/manual/core/ptr.rs
use std::{
ffi::c_void,
marker::PhantomData,
- mem,
+ mem::ManuallyDrop,
};
pub use ptr_extern::PtrExtern;
@@ -42,9 +42,7 @@ impl<T: ?Sized> Boxed for Ptr<T> where Self: PtrExtern {
#[inline]
fn into_raw(self) -> *mut c_void {
- let out = self.ptr;
- mem::forget(self);
- out
+ ManuallyDrop::new(self).ptr
}
#[inline]

MODIFY
src/manual/core/vector.rs
src/manual/core/vector.rs
@@ -4,7 +4,7 @@ use std::{
fmt,
iter::FromIterator,
marker::PhantomData,
- mem,
+ mem::ManuallyDrop,
};
pub use iter::{VectorIterator, VectorRefIterator};
@@ -224,9 +224,7 @@ impl<T: VectorElement> Boxed for Vector<T> where Self: VectorExtern<T> {
#[inline]
fn into_raw(self) -> *mut c_void {
- let out = self.ptr;
- mem::forget(self);
- out
+ ManuallyDrop::new(self).ptr
}
#[inline]

MODIFY
src/traits/boxed.rs
src/traits/boxed.rs
@@ -34,9 +34,7 @@ macro_rules! opencv_type_boxed {
#[inline]
fn into_raw(self) -> *mut std::ffi::c_void {
- let out = self.ptr;
- std::mem::forget(self);
- out
+ std::mem::ManuallyDrop::new(self).ptr
}
#[inline]

Change mem::forget to ManuallyDrop