We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f6be41 commit e8c3ba5Copy full SHA for e8c3ba5
src/lib.rs
@@ -49,17 +49,7 @@ pub fn raw<T>(data: T) -> *mut T {
49
#[cfg(any(feature = "alloc", feature = "std"))]
50
#[inline]
51
pub unsafe fn free<T>(pointer: *mut T) {
52
- #[cfg(any(feature = "panic-if-null", debug_assertions))]
53
- panic_if_null(pointer);
54
- // TODO: decide if remove this try to avoid crash when free a null pointer
55
- #[cfg(not(any(feature = "panic-if-null", debug_assertions)))]
56
- if pointer.is_null() {
57
- log::warn!("Trying to free a NULL pointer was ignored");
58
- return;
59
- }
60
- // CAUTION: this is unsafe
61
- Box::from_raw(pointer);
62
- // We let drop the boxed data.
+ own_back(pointer);
63
}
64
65
/// Opposite of [`raw<T>()`], to use Rust's ownership as usually.
0 commit comments