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 | ec100514f892bcdd02780c7a2181ecc8b3cb3cd9 (patch) | |
| tree | a0d29359e541054d1a286f361a0693727a2a2405 /example | |
| parent | 8430ec5e50ba477ad6e55e4e80987f6c32525b23 (diff) | |
| download | rust-ec100514f892bcdd02780c7a2181ecc8b3cb3cd9.tar.gz rust-ec100514f892bcdd02780c7a2181ecc8b3cb3cd9.zip | |
remove box_free and replace with drop impl
Diffstat (limited to 'example')
| -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 637b8dc53fe..c27b610f2ab 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -490,7 +490,8 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> fo impl<T: ?Sized, A: Allocator> Drop for Box<T, A> { fn drop(&mut self) { - // drop is currently performed by compiler. + // inner value is dropped by compiler + libc::free(self.pointer.0 as *mut u8); } } @@ -507,11 +508,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); |
