Freeze in std::marker - Rust (original) (raw)

pub unsafe auto trait Freeze { }

🔬This is a nightly-only experimental API. (freeze #121675)

Expand description

Used to determine whether a type contains any UnsafeCell internally, but not through an indirection. This affects, for example, whether a static of that type is placed in read-only static memory or writable static memory. This can be used to declare that a constant with a generic type will not contain interior mutability, and subsequently allow placing the constant behind references.

§Safety

This trait is a core part of the language, it is just expressed as a trait in libcore for convenience. Do not implement it for other types.