diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-01-07 01:10:50 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-01-07 23:25:31 +0100 |
| commit | 82af2a1847fd51dd82f38666283ec9ff174d7a74 (patch) | |
| tree | 7272d68e51be44192365cb25e43b540dd8810f66 /src/liballoc | |
| parent | 9f1ead8fadc56bad30dc74f5cc50d78af4fbc972 (diff) | |
| download | rust-82af2a1847fd51dd82f38666283ec9ff174d7a74.tar.gz rust-82af2a1847fd51dd82f38666283ec9ff174d7a74.zip | |
Add `Box::new` method. Prereq for feature-gating `box <expr>` itself.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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<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] |
