0.2.0 Preview 1 · Frozen documentation
NoUniqueAddress
Permits a field to overlap another subobject when target layout allows.
Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →
Module std.layout
import std.layout;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
NoUniqueAddress
pub attribute NoUniqueAddressPermits a field to overlap another subobject when target layout allows.
The attribute grants layout freedom but does not require overlap and does not weaken field lifetime, aliasing, or address-validity rules.
Example
module example.no_unique_address;
import std.layout as layout;
struct EmptyTag { }
pub struct TaggedCounter {
[layout.NoUniqueAddress]
priv Tag: EmptyTag;
pub Value: i32;
}
fn Main() -> i32 { return 0; }Documentation snapshot: October 24, 2026 About versions ↗