FA-43261 / Borrow checking / Open access
Destructuring through a reference moves a noncopy referent · case 01
Destructuring through a reference moves a noncopy referent.
ROOT CAUSE
The static analyzer mishandles deref move: destructuring through a reference moves a noncopy referent.
THE FAILURE
The static analyzer mishandles deref move: destructuring through a reference moves a noncopy referent.
Unsuccessful approach: The partial repair uses if bool(d['deref_moves']) and d['deref_moves'][0] not in d['copy']: errors.append('deref-move'), which still violates the stipulated analysis contract.
Case contract
Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.
Why this case matters
A finite offline static-analysis model of ownership and borrowing; it does not execute the analyzed program.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
errors=[]
if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
if False: errors.append('deref-move')
if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
if d['union'] and not d['unsafe']: errors.append('union-pattern')
if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
return errors
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| well formed empty obligations | [] | [] | Passed |
| binding-uniqueness regression 0 | ['binding-uniqueness'] | ['binding-uniqueness'] | Passed |
| binding-uniqueness regression 1 | ['binding-uniqueness'] | ['binding-uniqueness'] | Passed |
| alternative-name-agreement regression 0 | ['alternative-name-agreement'] | ['alternative-name-agreement'] | Passed |
| alternative-name-agreement regression 1 | ['alternative-name-agreement'] | ['alternative-name-agreement'] | Passed |
| alternative-mode-agreement regression 0 | ['alternative-mode-agreement'] | ['alternative-mode-agreement'] | Passed |
| alternative-mode-agreement regression 1 | ['alternative-mode-agreement'] | ['alternative-mode-agreement'] | Passed |
| mutable-binding regression 0 | ['mutable-binding'] | ['mutable-binding'] | Passed |
| mutable-binding regression 1 | ['mutable-binding'] | ['mutable-binding'] | Passed |
| deref-move regression 0 | [] | ['deref-move'] | Failed |
| deref-move regression 1 | [] | ['deref-move'] | Failed |
| rest-disjointness regression 0 | ['rest-disjointness'] | ['rest-disjointness'] | Passed |
| rest-disjointness regression 1 | ['rest-disjointness'] | ['rest-disjointness'] | Passed |
| union-pattern regression 0 | ['union-pattern'] | ['union-pattern'] | Passed |
| union-pattern regression 1 | ['union-pattern'] | ['union-pattern'] | Passed |
| guard-scope regression 0 | ['guard-scope'] | ['guard-scope'] | Passed |
| guard-scope regression 1 | ['guard-scope'] | ['guard-scope'] | Passed |
| move-borrow-overlap regression 0 | ['move-borrow-overlap'] | ['move-borrow-overlap'] | Passed |
| move-borrow-overlap regression 1 | ['move-borrow-overlap'] | ['move-borrow-overlap'] | Passed |
| default-mode-reset regression 0 | ['default-mode-reset'] | ['default-mode-reset'] | Passed |
| default-mode-reset regression 1 | ['default-mode-reset'] | ['default-mode-reset'] | Passed |
SHA-256 / 3f289205bcd935478321c58c93da8c719ec8e1d0a52674db07850ca107180f6c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
errors=[]
if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
if bool(d['deref_moves']) and d['deref_moves'][0] not in d['copy']: errors.append('deref-move')
if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
if d['union'] and not d['unsafe']: errors.append('union-pattern')
if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
return errors
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| well formed empty obligations | [] | [] | Passed |
| binding-uniqueness regression 0 | ['binding-uniqueness'] | ['binding-uniqueness'] | Passed |
| binding-uniqueness regression 1 | ['binding-uniqueness'] | ['binding-uniqueness'] | Passed |
| alternative-name-agreement regression 0 | ['alternative-name-agreement'] | ['alternative-name-agreement'] | Passed |
| alternative-name-agreement regression 1 | ['alternative-name-agreement'] | ['alternative-name-agreement'] | Passed |
| alternative-mode-agreement regression 0 | ['alternative-mode-agreement'] | ['alternative-mode-agreement'] | Passed |
| alternative-mode-agreement regression 1 | ['alternative-mode-agreement'] | ['alternative-mode-agreement'] | Passed |
| mutable-binding regression 0 | ['mutable-binding'] | ['mutable-binding'] | Passed |
| mutable-binding regression 1 | ['mutable-binding'] | ['mutable-binding'] | Passed |
| deref-move regression 0 | [] | ['deref-move'] | Failed |
| deref-move regression 1 | [] | ['deref-move'] | Failed |
| rest-disjointness regression 0 | ['rest-disjointness'] | ['rest-disjointness'] | Passed |
| rest-disjointness regression 1 | ['rest-disjointness'] | ['rest-disjointness'] | Passed |
| union-pattern regression 0 | ['union-pattern'] | ['union-pattern'] | Passed |
| union-pattern regression 1 | ['union-pattern'] | ['union-pattern'] | Passed |
| guard-scope regression 0 | ['guard-scope'] | ['guard-scope'] | Passed |
| guard-scope regression 1 | ['guard-scope'] | ['guard-scope'] | Passed |
| move-borrow-overlap regression 0 | ['move-borrow-overlap'] | ['move-borrow-overlap'] | Passed |
| move-borrow-overlap regression 1 | ['move-borrow-overlap'] | ['move-borrow-overlap'] | Passed |
| default-mode-reset regression 0 | ['default-mode-reset'] | ['default-mode-reset'] | Passed |
| default-mode-reset regression 1 | ['default-mode-reset'] | ['default-mode-reset'] | Passed |
SHA-256 / 6a30760c68d2f6f12aafd06bb377a5b2b1c815f22e132610df1aa5eff7e4c09f
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 21 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
The explicitly stated toy language is the complete scope; this is not a production compiler or a claim about Rust semantics. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:44:00.173676+00:00.
Case digest / 3546bb406a83596655b6f46fa1afde07c073bbfc054cf35828dfe93f58f9919d