about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-02-06 01:24:22 +0000
committerbors <bors@rust-lang.org>2016-02-06 01:24:22 +0000
commit5147c1f2c04f62dceea5feaf6a2dcbebf5cd638f (patch)
tree4d8cd52215cb214be361a4fe29e750597fdd6a61 /src/doc
parent34af2de4096b3b1c5d3a5b70171c6e27822aaefb (diff)
parentcaf62ef9846edfd41177b883181c5c045ca69859 (diff)
downloadrust-5147c1f2c04f62dceea5feaf6a2dcbebf5cd638f.tar.gz
rust-5147c1f2c04f62dceea5feaf6a2dcbebf5cd638f.zip
Auto merge of #31307 - nagisa:mir-drop-terminator, r=nikomatsakis
The scope of these refactorings is a little bit bigger than the title implies. See each commit for details.

I’m submitting this for nitpicking now (the first 4 commits), because I feel the basic idea/implementation is sound and should work. I will eventually expand this PR to cover the translator changes necessary for all this to work (+ tests), ~~and perhaps implement a dynamic dropping scheme while I’m at it as well.~~

r? @nikomatsakis
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/book/lang-items.md6
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;