FAILURE MAP
← Case archive

FA-44186 / Borrow checking / Open access

A continuation result escapes from an origin absent in its borrow summary · case 01

A continuation result escapes from an origin absent in its borrow summary.

Verified by executionVariant 1 · 21 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The static analyzer mishandles continuation return summary: a continuation result escapes from an origin absent in its borrow summary.

THE FAILURE

The static analyzer mishandles continuation return summary: a continuation result escapes from an origin absent in its borrow summary.

Unsuccessful approach: The partial repair uses if not d['declared_returns'] and bool(d['result_origins']): errors.append('continuation-return-summary'), which still violates the stipulated analysis contract.

Case contract

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. 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['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if False: errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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 fixtureActualExpectedOutcome
well formed empty obligations[][]Passed
one-shot-resume regression 0['one-shot-resume']['one-shot-resume']Passed
one-shot-resume regression 1['one-shot-resume']['one-shot-resume']Passed
abort-capture-release regression 0['abort-capture-release']['abort-capture-release']Passed
abort-capture-release regression 1['abort-capture-release']['abort-capture-release']Passed
escape-capture-stack regression 0['escape-capture-stack']['escape-capture-stack']Passed
escape-capture-stack regression 1['escape-capture-stack']['escape-capture-stack']Passed
clone-unique-capture regression 0['clone-unique-capture']['clone-unique-capture']Passed
clone-unique-capture regression 1['clone-unique-capture']['clone-unique-capture']Passed
resume-loan-restore regression 0['resume-loan-restore']['resume-loan-restore']Passed
resume-loan-restore regression 1['resume-loan-restore']['resume-loan-restore']Passed
captured-owner-duration regression 0['captured-owner-duration']['captured-owner-duration']Passed
captured-owner-duration regression 1['captured-owner-duration']['captured-owner-duration']Passed
argument-transfer-once regression 0['argument-transfer-once']['argument-transfer-once']Passed
argument-transfer-once regression 1['argument-transfer-once']['argument-transfer-once']Passed
handler-capture-boundary regression 0['handler-capture-boundary']['handler-capture-boundary']Passed
handler-capture-boundary regression 1['handler-capture-boundary']['handler-capture-boundary']Passed
unwind-frame-result regression 0['unwind-frame-result']['unwind-frame-result']Passed
unwind-frame-result regression 1['unwind-frame-result']['unwind-frame-result']Passed
continuation-return-summary regression 0[]['continuation-return-summary']Failed
continuation-return-summary regression 1[]['continuation-return-summary']Failed

SHA-256 / 3b4fa7b4ca7ca19bd434a96ba51eadd45db00dd263336d4245a94532fcafdcd4

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['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not d['declared_returns'] and bool(d['result_origins']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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 fixtureActualExpectedOutcome
well formed empty obligations[][]Passed
one-shot-resume regression 0['one-shot-resume']['one-shot-resume']Passed
one-shot-resume regression 1['one-shot-resume']['one-shot-resume']Passed
abort-capture-release regression 0['abort-capture-release']['abort-capture-release']Passed
abort-capture-release regression 1['abort-capture-release']['abort-capture-release']Passed
escape-capture-stack regression 0['escape-capture-stack']['escape-capture-stack']Passed
escape-capture-stack regression 1['escape-capture-stack']['escape-capture-stack']Passed
clone-unique-capture regression 0['clone-unique-capture']['clone-unique-capture']Passed
clone-unique-capture regression 1['clone-unique-capture']['clone-unique-capture']Passed
resume-loan-restore regression 0['resume-loan-restore']['resume-loan-restore']Passed
resume-loan-restore regression 1['resume-loan-restore']['resume-loan-restore']Passed
captured-owner-duration regression 0['captured-owner-duration']['captured-owner-duration']Passed
captured-owner-duration regression 1['captured-owner-duration']['captured-owner-duration']Passed
argument-transfer-once regression 0['argument-transfer-once']['argument-transfer-once']Passed
argument-transfer-once regression 1['argument-transfer-once']['argument-transfer-once']Passed
handler-capture-boundary regression 0['handler-capture-boundary']['handler-capture-boundary']Passed
handler-capture-boundary regression 1['handler-capture-boundary']['handler-capture-boundary']Passed
unwind-frame-result regression 0['unwind-frame-result']['unwind-frame-result']Passed
unwind-frame-result regression 1['unwind-frame-result']['unwind-frame-result']Passed
continuation-return-summary regression 0[]['continuation-return-summary']Failed
continuation-return-summary regression 1[]['continuation-return-summary']Failed

SHA-256 / e5b1da38e9f8f02e2867f16d903215145fad3f9dbe6e5fd5e145d978a0428dc7

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:09.693299+00:00.

Case digest / b9ab42dde56a58a11fe05013839a3a490151c256fcccaa38c3998dbefc7cb2e4