Development · Evolving reference
NoUniqueAddress
Permits a field to overlap another subobject when target layout allows.
Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. 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 ↗