Function core::mem::uninitialized
[−]
[src]
pub unsafe fn uninitialized<T>() -> T
Creates an uninitialized value.
Care must be taken when using this function, if the type T
has a destructor and the value
falls out of scope (due to unwinding or returning) before being initialized, then the
destructor will run on uninitialized data, likely leading to crashes.
This is useful for FFI functions sometimes, but should generally be avoided.
Examples
fn main() { use std::mem; let x: i32 = unsafe { mem::uninitialized() }; }use std::mem; let x: i32 = unsafe { mem::uninitialized() };