]> git.lizzy.rs Git - rust.git/commitdiff
Add `Box::new` method. Prereq for feature-gating `box <expr>` itself.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 7 Jan 2015 00:10:50 +0000 (01:10 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 7 Jan 2015 22:25:31 +0000 (23:25 +0100)
src/liballoc/boxed.rs

index d46f18abf97b481f781225bc42b7d291cc399f37..cec49fa6186ee724fd8f4b0a117906d4b8f7631c 100644 (file)
 #[stable]
 pub struct Box<T>(Unique<T>);
 
+#[unstable]
+impl<T> Box<T> {
+    /// Moves `x` into a freshly allocated box on the global exchange heap.
+    #[unstable]
+    pub fn new(x: T) -> Box<T> {
+        box x
+    }
+}
+
 #[stable]
 impl<T: Default> Default for Box<T> {
     #[stable]