Skip to content

Commit 82af2a1

Browse files
committed
Add Box::new method. Prereq for feature-gating box <expr> itself.
1 parent 9f1ead8 commit 82af2a1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/liballoc/boxed.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ pub static HEAP: () = ();
4949
#[stable]
5050
pub struct Box<T>(Unique<T>);
5151

52+
#[unstable]
53+
impl<T> Box<T> {
54+
/// Moves `x` into a freshly allocated box on the global exchange heap.
55+
#[unstable]
56+
pub fn new(x: T) -> Box<T> {
57+
box x
58+
}
59+
}
60+
5261
#[stable]
5362
impl<T: Default> Default for Box<T> {
5463
#[stable]

0 commit comments

Comments
 (0)