about summary refs log tree commit diff
path: root/src/libstd/owned.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-17 16:46:18 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-09 16:05:34 -0800
commite12711540a00ded4021250f7b2a31773fc4dc734 (patch)
tree036d04e2767d3bda4217c832f1a083c1a68b2c55 /src/libstd/owned.rs
parentdd11fe17c7cf3661905c952d8233527abbff4c11 (diff)
downloadrust-e12711540a00ded4021250f7b2a31773fc4dc734.tar.gz
rust-e12711540a00ded4021250f7b2a31773fc4dc734.zip
librustc: Implement placement `box` for GC and unique pointers.
Diffstat (limited to 'src/libstd/owned.rs')
-rw-r--r--src/libstd/owned.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/owned.rs b/src/libstd/owned.rs
index 424c4fd6b2f..dc8ea34c84b 100644
--- a/src/libstd/owned.rs
+++ b/src/libstd/owned.rs
@@ -12,6 +12,20 @@
 
 #[cfg(not(test))] use cmp::*;
 
+/// A value that represents the global exchange heap. This is the default
+/// place that the `box` keyword allocates into when no place is supplied.
+///
+/// The following two examples are equivalent:
+///
+///     let foo = box(HEAP) Bar::new(...);
+///     let foo = box Bar::new(...);
+#[lang="exchange_heap"]
+#[cfg(not(test))]
+pub static HEAP: () = ();
+
+#[cfg(test)]
+pub static HEAP: () = ();
+
 #[cfg(not(test))]
 impl<T:Eq> Eq for ~T {
     #[inline]