Function std::ptr::dangling_mut
const: 1.61.0 · source · pub const fn dangling_mut<T>() -> *mut T
🔬This is a nightly-only experimental API. (
strict_provenance
#95228)Expand description
Creates a new pointer that is dangling, but well-aligned.
This is useful for initializing types which lazily allocate, like
Vec::new
does.
Note that the pointer value may potentially represent a valid pointer to
a T
, which means this must not be used as a “not yet initialized”
sentinel value. Types that lazily allocate must track initialization by
some other means.