From 432460a6fc92e8baecbc4fa175345e78232fe2ed Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 28 Jan 2016 23:59:00 +0200 Subject: Synthesize calls to box_free language item This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which takes care of dropping instead. --- src/doc/book/lang-items.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/doc') diff --git a/src/doc/book/lang-items.md b/src/doc/book/lang-items.md index e492bd3e782..b948567ac5b 100644 --- a/src/doc/book/lang-items.md +++ b/src/doc/book/lang-items.md @@ -39,11 +39,17 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { p } + #[lang = "exchange_free"] unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) { libc::free(ptr as *mut libc::c_void) } +#[lang = "box_free"] +unsafe fn box_free(ptr: *mut T) { + deallocate(ptr as *mut u8, ::core::mem::size_of::(), ::core::mem::align_of::()); +} + #[start] fn main(argc: isize, argv: *const *const u8) -> isize { let x = box 1; -- cgit 1.4.1-3-g733a5