Skip to main content

alloc/
intrinsics.rs

1//! Intrinsics that cannot be moved to `core` because they depend on `alloc` types.
2#![unstable(feature = "liballoc_internals", issue = "none")]
3
4use core::mem::MaybeUninit;
5
6use crate::boxed::Box;
7
8/// Writes `x` into `b`.
9///
10/// This is needed for `vec!`, which can't afford any extra copies of the argument (or else debug
11/// builds regress), has to be written fully as a call chain without `let` (or else this breaks inference
12/// of e.g. unsizing coercions), and can't use an `unsafe` block as that would then also
13/// include the user-provided `$x`.
14#[rustc_intrinsic]
15pub fn write_box_via_move<T>(b: Box<MaybeUninit<T>>, x: T) -> Box<MaybeUninit<T>>;