Skip to content

Commit f429b3e

Browse files
committed
remove box_free and replace with drop impl
1 parent 81ea0b2 commit f429b3e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

example/mini_core.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ impl<T> Box<T> {
546546

547547
impl<T: ?Sized, A> Drop for Box<T, A> {
548548
fn drop(&mut self) {
549-
// drop is currently performed by compiler.
549+
// inner value is dropped by compiler
550+
libc::free(self.0.pointer.0 as *mut u8);
550551
}
551552
}
552553

@@ -563,11 +564,6 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
563564
libc::malloc(size)
564565
}
565566

566-
#[lang = "box_free"]
567-
unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) {
568-
libc::free(ptr.pointer.0 as *mut u8);
569-
}
570-
571567
#[lang = "drop"]
572568
pub trait Drop {
573569
fn drop(&mut self);

0 commit comments

Comments
 (0)