From 82af2a1847fd51dd82f38666283ec9ff174d7a74 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 7 Jan 2015 01:10:50 +0100 Subject: [PATCH] Add `Box::new` method. Prereq for feature-gating `box ` itself. --- src/liballoc/boxed.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index d46f18abf97..cec49fa6186 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -49,6 +49,15 @@ pub static HEAP: () = (); #[stable] pub struct Box(Unique); +#[unstable] +impl Box { + /// Moves `x` into a freshly allocated box on the global exchange heap. + #[unstable] + pub fn new(x: T) -> Box { + box x + } +} + #[stable] impl Default for Box { #[stable]