Summary
During the A7 pattern-discard fixes (0e22d06f, 60cc437f), the enum-variant payload rest (.A(a, ..)) was found to leak its discarded Drop payloads (bare continue on NK_PAT_REST in the variant binding path) and was fixed. The positional-struct pattern path in MirLower.lower_pattern (the positional_struct_pattern_type branch) has its own NK_PAT_REST skip that was NOT probed or fixed.
Spec
§9.7 Pattern Matching — rest patterns discard the remaining elements; §2.4/§2.5 — discarded Drop values must drop exactly once (a leak is a soundness bug in the drop obligation, per the A7 precedent).
Repro sketch (unverified)
type P { a: W, b: W, c: W } // W: impl Drop
match mk():
P(x, ..) => () // if positional struct patterns parse — do the
// rest-discarded Drop fields b, c leak?
Probe heap-backed under --debug-alloc; expected leak count=0. If it leaks, apply the same anonymous drop-local treatment as the variant-path rest fix (60cc437f).
Workaround
None needed for named-field patterns ({ x, .. } was fixed in 0e22d06f).
Summary
During the A7 pattern-discard fixes (0e22d06f, 60cc437f), the enum-variant payload rest (
.A(a, ..)) was found to leak its discarded Drop payloads (barecontinueon NK_PAT_REST in the variant binding path) and was fixed. The positional-struct pattern path inMirLower.lower_pattern(thepositional_struct_pattern_typebranch) has its ownNK_PAT_RESTskip that was NOT probed or fixed.Spec
§9.7 Pattern Matching — rest patterns discard the remaining elements; §2.4/§2.5 — discarded Drop values must drop exactly once (a leak is a soundness bug in the drop obligation, per the A7 precedent).
Repro sketch (unverified)
Probe heap-backed under
--debug-alloc; expected leak count=0. If it leaks, apply the same anonymous drop-local treatment as the variant-path rest fix (60cc437f).Workaround
None needed for named-field patterns (
{ x, .. }was fixed in 0e22d06f).