Skip to content

quest: plan compile-time ownership for the Swift and C++ bindings - #692

Merged
kixelated merged 1 commit into
mainfrom
quest-plan/compile-checks-followups
Nov 10, 2026
Merged

kixelated merged 1 commit into
mainfrom
quest-plan/compile-checks-followups

Conversation

@kixelated

@kixelated kixelated commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Plans the two follow-ups of the compile-checks spike, moq-dev/rust2#688, in the exporter epic. It changes no code.

Problem

The spike found that Swift's ~Copyable handles and Clang's typestate and lifetime attributes turn most of the binding tests that break an ownership rule into compile errors. The maintainer decided to adopt both. No quest owned the work.

Approach

  • quest/m1/ffi-export/swift-noncopyable.md [L]: Swift handles become ~Copyable structs, tuples become named structs, and arrays become UniqueArray. The hold count is dropped after a release measurement, and Swift 6.4 conformances come in under #if. It is checked on an Apple platform.
  • quest/m1/ffi-export/cpp-attributes.md [S]: C++ gets typestate attributes, lifetime attributes, and api::borrow<T>, behind macros.
  • Both are listed in the epic README. Each notes how it interacts with moq-dev/rust2#678: whichever lands second adapts.

Decisions

All settled with the maintainer on 2026-11-09 and recorded in each quest's Plan.

  • Swift switch: ✅ ~Copyable handles, tuples as generated structs, arrays as swift-collections' UniqueArray (rejected: own list type; wait for Swift's Array; no switch).
  • Swift hold count: ✅ drop it after a release-build measurement (rejected: keep it).
  • Swift Option<&T>: ✅ an overload per optional borrowed parameter (rejected: one borrowing T? signature; a generated Borrowed<T>).
  • Swift goal: ✅ as stated in the quest (rejected: leaving arrays and tuples out).
  • C++: ✅ all three, typestate, lifetime, and api::borrow<T> (rejected: attributes only; no change).
  • Milestone, both: ✅ m1 exporter epic (rejected: m2), since each breaks the generated API, which is cheapest before moq adopts.

Impact

None: only the quest tree changes.

Alternatives

Folding the Swift hold-count drop into checks-raise: it's linked as related instead, since it only applies once handles are non-copyable.

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, Opus 5.5, high effort

(Written by Opus 5.5 with high)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, medium effort
  • Session: 01a1c3c4-b4bc-7191-a25a-02e6a1d643d0, round 1
  • Head: 083f77b
  • Base: origin/main at 53f66f9
  • Score: 10/10, The change adds only planning documents and links, changes no executable code or tests, and has no actionable defects.
  • Findings: none

Follow-ups of the compile-checks spike (#688).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pullfrog

pullfrog Bot commented Nov 10, 2026

Copy link
Copy Markdown

Pullfrog  | Review this ➔

@kixelated
kixelated marked this pull request as ready for review November 10, 2026 04:43
@kixelated
kixelated added this pull request to the merge queue Nov 10, 2026
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce2fa95b-77fe-40f3-9813-e99e006cfa90
Commits

Reviewing files that changed from the base of the PR and between 53f66f9 and 083f77b.

Files selected for processing: 3

  • quest/m1/ffi-export/README.md
  • quest/m1/ffi-export/cpp-attributes.md
  • quest/m1/ffi-export/swift-noncopyable.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Merged via the queue into main with commit 493930e Nov 10, 2026
7 checks passed
@kixelated
kixelated deleted the quest-plan/compile-checks-followups branch November 10, 2026 04:57
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