dangling in std::ptr - Rust
Description: Creates a new pointer that is dangling, but non-null and well-aligned.

## dangling

# Function dangling

1.84.0 (const: 1.84.0) · Source

    pub const fn dangling<T>() -> *const T

Expand description

Creates a new pointer that is dangling, but non-null and well-aligned.

This is useful for initializing types which lazily allocate, like `Vec::new` does.

Note that the address of the returned pointer may potentially be that of a valid pointer, 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.