diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2016-01-28 23:59:00 +0200 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2016-02-04 15:56:01 +0200 |
| commit | 432460a6fc92e8baecbc4fa175345e78232fe2ed (patch) | |
| tree | d59c70df2e2c0c9234f8134be320a5932be8d792 /src/doc | |
| parent | 7b9d6d3bc8730aa565dbb5e285027443696aef0c (diff) | |
| download | rust-432460a6fc92e8baecbc4fa175345e78232fe2ed.tar.gz rust-432460a6fc92e8baecbc4fa175345e78232fe2ed.zip | |
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.
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/book/lang-items.md | 6 |
1 files changed, 6 insertions, 0 deletions
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<T>(ptr: *mut T) { + deallocate(ptr as *mut u8, ::core::mem::size_of::<T>(), ::core::mem::align_of::<T>()); +} + #[start] fn main(argc: isize, argv: *const *const u8) -> isize { let x = box 1; |
