FA-44311 / Borrow checking / Open access
Compound assignment evaluates a borrowing destination expression twice · case 01
Compound assignment evaluates a borrowing destination expression twice.
ROOT CAUSE
The static analyzer mishandles compound destination once: compound assignment evaluates a borrowing destination expression twice.
THE FAILURE
The static analyzer mishandles compound destination once: compound assignment evaluates a borrowing destination expression twice.
Unsuccessful approach: The partial repair uses if d['compound_assignment'] and d['destination_evaluations']==0: errors.append('compound-destination-once'), which still violates the stipulated analysis contract.
Case contract
Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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 d['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
if False: errors.append('compound-destination-once')
if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
return errors
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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 |
| for-owner-duration regression 0 | ['for-owner-duration'] | ['for-owner-duration'] | Passed |
| for-owner-duration regression 1 | ['for-owner-duration'] | ['for-owner-duration'] | Passed |
| question-error-cleanup regression 0 | ['question-error-cleanup'] | ['question-error-cleanup'] | Passed |
| question-error-cleanup regression 1 | ['question-error-cleanup'] | ['question-error-cleanup'] | Passed |
| short-circuit-conditional regression 0 | ['short-circuit-conditional'] | ['short-circuit-conditional'] | Passed |
| short-circuit-conditional regression 1 | ['short-circuit-conditional'] | ['short-circuit-conditional'] | Passed |
| autoref-after-autoderef regression 0 | ['autoref-after-autoderef'] | ['autoref-after-autoderef'] | Passed |
| autoref-after-autoderef regression 1 | ['autoref-after-autoderef'] | ['autoref-after-autoderef'] | Passed |
| compound-destination-once regression 0 | [] | ['compound-destination-once'] | Failed |
| compound-destination-once regression 1 | [] | ['compound-destination-once'] | Failed |
| index-evaluation-order regression 0 | ['index-evaluation-order'] | ['index-evaluation-order'] | Passed |
| index-evaluation-order regression 1 | ['index-evaluation-order'] | ['index-evaluation-order'] | Passed |
| await-future-owner regression 0 | ['await-future-owner'] | ['await-future-owner'] | Passed |
| await-future-owner regression 1 | ['await-future-owner'] | ['await-future-owner'] | Passed |
| let-else-binding-scope regression 0 | ['let-else-binding-scope'] | ['let-else-binding-scope'] | Passed |
| let-else-binding-scope regression 1 | ['let-else-binding-scope'] | ['let-else-binding-scope'] | Passed |
| destructure-stage-rhs regression 0 | ['destructure-stage-rhs'] | ['destructure-stage-rhs'] | Passed |
| destructure-stage-rhs regression 1 | ['destructure-stage-rhs'] | ['destructure-stage-rhs'] | Passed |
| return-before-cleanup regression 0 | ['return-before-cleanup'] | ['return-before-cleanup'] | Passed |
| return-before-cleanup regression 1 | ['return-before-cleanup'] | ['return-before-cleanup'] | Passed |
SHA-256 / 57ac6d02bbf8d5d58fa6c3593c7ffb7b3ad67aeaa6db4bf276c480522c2aad20
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
errors=[]
if d['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
if d['compound_assignment'] and d['destination_evaluations']==0: errors.append('compound-destination-once')
if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
return errors
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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 |
| for-owner-duration regression 0 | ['for-owner-duration'] | ['for-owner-duration'] | Passed |
| for-owner-duration regression 1 | ['for-owner-duration'] | ['for-owner-duration'] | Passed |
| question-error-cleanup regression 0 | ['question-error-cleanup'] | ['question-error-cleanup'] | Passed |
| question-error-cleanup regression 1 | ['question-error-cleanup'] | ['question-error-cleanup'] | Passed |
| short-circuit-conditional regression 0 | ['short-circuit-conditional'] | ['short-circuit-conditional'] | Passed |
| short-circuit-conditional regression 1 | ['short-circuit-conditional'] | ['short-circuit-conditional'] | Passed |
| autoref-after-autoderef regression 0 | ['autoref-after-autoderef'] | ['autoref-after-autoderef'] | Passed |
| autoref-after-autoderef regression 1 | ['autoref-after-autoderef'] | ['autoref-after-autoderef'] | Passed |
| compound-destination-once regression 0 | [] | ['compound-destination-once'] | Failed |
| compound-destination-once regression 1 | [] | ['compound-destination-once'] | Failed |
| index-evaluation-order regression 0 | ['index-evaluation-order'] | ['index-evaluation-order'] | Passed |
| index-evaluation-order regression 1 | ['index-evaluation-order'] | ['index-evaluation-order'] | Passed |
| await-future-owner regression 0 | ['await-future-owner'] | ['await-future-owner'] | Passed |
| await-future-owner regression 1 | ['await-future-owner'] | ['await-future-owner'] | Passed |
| let-else-binding-scope regression 0 | ['let-else-binding-scope'] | ['let-else-binding-scope'] | Passed |
| let-else-binding-scope regression 1 | ['let-else-binding-scope'] | ['let-else-binding-scope'] | Passed |
| destructure-stage-rhs regression 0 | ['destructure-stage-rhs'] | ['destructure-stage-rhs'] | Passed |
| destructure-stage-rhs regression 1 | ['destructure-stage-rhs'] | ['destructure-stage-rhs'] | Passed |
| return-before-cleanup regression 0 | ['return-before-cleanup'] | ['return-before-cleanup'] | Passed |
| return-before-cleanup regression 1 | ['return-before-cleanup'] | ['return-before-cleanup'] | Passed |
SHA-256 / 91b243c11fe99808801dbb6eee596f3681dda71244c0ee198517e014a6282a9d
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:11.156465+00:00.
Case digest / 6b4b8fa63c19e1ae928af0e0f75f78c7c6b068312c0d32f8d2d11ac745e1bd9d