Skip to content

fix(mir): preserve contextual Sink handoff ownership - #2983

Open
slepp wants to merge 3 commits into
mainfrom
codex/file-io-sink-close-drop-plan
Open

fix(mir): preserve contextual Sink handoff ownership#2983
slepp wants to merge 3 commits into
mainfrom
codex/file-io-sink-close-drop-plan

Conversation

@slepp

@slepp slepp commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve exact ownership authority when contextual destructuring transfers a Sink through an owned Result carrier;
  • correlate the matching move, neutralization, transferee, destination, and typed close receiver before suppressing carrier drop;
  • fail closed for contradictory, shadowed, reused, unowned, non-Sink, and unrelated move shapes.

Verification

  • focused contextual ownership/drop tests, contradiction negatives, and typed receiver checks
  • native/LLVM close-count execution coverage
  • same-head MIR suite (1,734 tests), Clippy, and formatting
  • compatible examples codegen (84/84), repository tests (29/29), and clean-port blog integration (20/20)

Out of scope

  • broad clone/copy-on-write policy, D242, ABI changes, unsafe/runtime changes, public examples pins, and unrelated ownership lowering.

slepp added 3 commits August 18, 2026 13:16
I retain the concrete place for scoped close-obligated binders and transfer fresh Sink payload ownership without duplicating the carrier close. I pin every contextual exit and keep untyped runtime calls fail-closed.
I exercise implicit and explicit file-sink cleanup across every contextual binder form under allocator hardening. I also count native close sites per function and distinguish source closes.
I correlate each payload move with its exact neutralization and require a fresh owned Result carrier plus the precise owning destination. I keep typed Sink receiver borrowing fail-closed at wrong types, positions, and authorities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant