Repository navigation
quest: plan Option::cloned through Clone - #244
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit 1095ca644a3efc88a95078236f956044237134ed.
No actionable defects found in this plan. The current Option lowering does share copied with cloned, and auditing the iterator/helper path rather than assuming it is correct is warranted. Keeping this std-mapping fix separate from shared-ownership runtime work is a sensible boundary; reuse the common Clone-dispatch logic instead of adding an Arc-only exception.
Nonblocking implementation coverage: include None (no Clone call), a Copy type with a side-effecting hand-written Clone, and nested Vec/derived aggregates checking both counts and independence. Preserve Option sentinel representation and mutable-reference unwrapping when mapping the payload.
Verification: static inspection of the plan and relevant Option/iterator/clone-helper code, independently checked. This PR contains no implementation fix; I did not run differential tests or verify the reported quest check.
Problem
Option::clonedlowers throughTranslator::copied, which skipsClone. Sov.first().cloned()of aVec<Arc<T>>takes no strong count but later drops one, and a hand-writtenClonenever runs. The output type-checks, so the miscompile is silent. Found while writing #238's fixture, which uses.map(Arc::clone)instead.Approach
This plans one quest,
quest/m2/ts-option-cloned.md, ranked right after Shared ownership in m2.clonedmaps the payload asIterator::clonedalready does: through the copy shim whereCloneonly copies, and throughClone::cloneotherwise.clone_copiesassumes aCopytype, soVec<Arc<T>>passes as copying. The quest checksIterator::clonedfor this gap too and fixes every instance.Option::clonedon map lookups and handles (for examplekio/src/log.rsand moq-net'sietf/subscriber.rs), so translating the model would miscount silently.Impact
Alternatives
Cloneimpls on types with noArcat all.Follow-ups
None.
Review
Skipped: this is a quest-only change (one new quest and its link in
quest/m2/README.md), withquest checkpassing on head1095ca644a3efc88a95078236f956044237134ed.🤖 Generated with Claude Code
(written by Claude Opus 5.5)