about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-08-01 13:51:58 -0700
committerDrMeepster <19316085+DrMeepster@users.noreply.github.com>2023-06-16 13:41:06 -0700
commita5c6cb888eac7ad8905a3902b985e412aaceb002 (patch)
tree18124f347f8405e4d746023018fa354580efac00 /compiler/rustc_codegen_gcc
parent0966f3202d1e811cd3aa35ac876b61a211b4819a (diff)
downloadrust-a5c6cb888eac7ad8905a3902b985e412aaceb002.tar.gz
rust-a5c6cb888eac7ad8905a3902b985e412aaceb002.zip
remove box_free and replace with drop impl
Diffstat (limited to 'compiler/rustc_codegen_gcc')
-rw-r--r--compiler/rustc_codegen_gcc/example/mini_core.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs
index 637b8dc53fe..c27b610f2ab 100644
--- a/compiler/rustc_codegen_gcc/example/mini_core.rs
+++ b/compiler/rustc_codegen_gcc/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);