You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A Drop value whose bytes are all zero is indistinguishable from the reset-on-move sentinel: its destructor is skipped (Vec element, enum payload, moved value) #1431
Fd { n: 0 } in the Vec is never closed. The same happens for an enum payload: let e = E.B(14, Handle { p: null }) in a function never runs Handle.drop, while Handle { p: cell_new() } in the same position does. The MIR schedules drop(_1) for the enum local in both cases, so the drop is lost at the guarded destructor, not in drop elaboration.
Why
Spec §2.5.1: "The reset is unconditional (every move blanks its source) and the null guard is part of the destructor itself." The guard cannot tell a blanked value from a live value whose representation is all zero:
a file descriptor 0;
a null handle a user type legitimately owns;
an index of 0;
a by-value C token whose id is 0.
On a single never-moved owner the guard is elided (§2.5.2), so let f = Fd { n: 0 } in a function does close. On a moved value, or inside a Vec or an enum, it does not. The result is a skipped destructor: a leak, or a descriptor never closed. §2.5.1 calls that a defect.
Impact on modeled C (D51)
The facade renderings are not affected today, but only by construction:
a rendered resource carries live: true;
a failed-state resource (Failed<R>, stage 5) holds a non-NULL pointer.
A by-value C token resource that dropped the live byte would be exposed.
Question
This is the §2.5.1 mechanism, so it needs a ruling rather than a spot fix. The options:
a reserved blank bit or tag for types whose zero pattern is a valid live value;
live bits generalized by the compiler;
a spec sentence restricting what a Drop type's representation may be.
Ruled by Eric (D72, spec v7.5, PR #1784): a Drop type whose all-zero storage can be a live value gets a hidden liveness byte; types with an owning non-null field pay nothing. Implementation on the batch-2 ownership layer.
Activity
Spec v7.5 (D72, D73): a Drop type whose all-zero storage is a live va…
ehartford commentedon Sep 27, 2026
Ruled by Eric (D72, spec v7.5, PR #1784): a Drop type whose all-zero storage can be a live value gets a hidden liveness byte; types with an owning non-null field pay nothing. Implementation on the batch-2 ownership layer.
D72: a `Drop` struct whose all-zero storage is a live value carries a…
Ownership: D72 liveness byte, D73 assignment-as-read, validator leak/…