diff options
| author | DrMeepster <19316085+DrMeepster@users.noreply.github.com> | 2022-08-01 13:51:58 -0700 |
|---|---|---|
| committer | DrMeepster <19316085+DrMeepster@users.noreply.github.com> | 2023-06-16 13:41:06 -0700 |
| commit | f429b3e67f641ca06508d8fd19529b3f33e1e40e (patch) | |
| tree | a7508ffd985b9abb1b85b1c158f1c78b00613558 | |
| parent | 81ea0b29ea3a8d426e8cf8362fefaa61906c1b91 (diff) | |
| download | rust-f429b3e67f641ca06508d8fd19529b3f33e1e40e.tar.gz rust-f429b3e67f641ca06508d8fd19529b3f33e1e40e.zip | |
remove box_free and replace with drop impl
| -rw-r--r-- | example/mini_core.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs index 772dd98fade..79ca4c03985 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -546,7 +546,8 @@ impl<T> Box<T> { impl<T: ?Sized, A> Drop for Box<T, A> { fn drop(&mut self) { - // drop is currently performed by compiler. + // inner value is dropped by compiler + libc::free(self.0.pointer.0 as *mut u8); } } @@ -563,11 +564,6 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { libc::malloc(size) } -#[lang = "box_free"] -unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) { - libc::free(ptr.pointer.0 as *mut u8); -} - #[lang = "drop"] pub trait Drop { fn drop(&mut self); |
