We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a17780d commit 49cc548Copy full SHA for 49cc548
library/alloc/src/boxed.rs
@@ -239,7 +239,9 @@ pub struct Box<
239
/// This is the surface syntax for `box <expr>` expressions.
240
#[rustc_intrinsic]
241
#[unstable(feature = "liballoc_internals", issue = "none")]
242
-pub fn box_new<T>(x: T) -> Box<T>;
+pub fn box_new<T>(x: T) -> Box<T> {
243
+ Box::write(Box::new_uninit(), x)
244
+}
245
246
impl<T> Box<T> {
247
/// Allocates memory on the heap and then places `x` into it.
0 commit comments