Repository navigation
feat(ts): translate Arc and Rc of dyn Iterator, and dyn FusedIterator - #478
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou'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 59 minutes. View limit details
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. CodeRabbit Verify
|
kixelated
enabled auto-merge
November 3, 2026 04:04
kixelated
added a commit
that referenced
this pull request
Nov 3, 2026
#478's `dyns` cases regenerate in the `dyns` fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since #437, a
dyn Iterator,dyn DoubleEndedIterator, ordyn ExactSizeIteratortranslates behind&,&mut, andBox. Several forms were still refused:Arc,Rc, orWeakof one, refused as "a trait object of another crate's trait".Arc::get_mutof one, an "unsupported call".dyn FusedIteratorbehind any pointer.The trait objects quest names
Arc<dyn Iterator>anddyn FusedIterator. moq builds neither; this is std coverage the quest calls for.Approach
dyn FusedIteratorjoins the family: anrt.Iter, made byrt.iterDynas the others are. Its vtable isIterator's.ArcorRcunsized to one of these is anrt.ArcDynoverrt.iterDynof the iterator theArcholds, built asdyn Future's is. AWeakcoerced to one, andArc::from(Box<dyn Iterator>), follow from #450. The lastArcdrops the iterator, and so the items it still owns.Arc::get_mutandRc::get_mutof a trait object lend its object while no otherArcorWeakshares it, as they do for a sized value. This covers the crate's own traits too.dyn Any's stays refused. Its object may hold a copy of a value JS copies, andArc::downcastgives back theArc<T>, which would not see a write made throughget_mut.Also, as the maintainer decided,
quest/m3/ts-refcell-debug.mdnow coversDebugof aCelltoo.Tests:
dyns::itersin the lang fixture's differential test against native wasm32 now also covers:&mut dyn FusedIterator, afuseof the crate's own iterator that resumes after its end, aBox<dyn FusedIterator>of the crate's own fused iterator, and the resuming one unfused, throughdyn Iterator, for contrast.Arc<dyn Iterator<Item = Tagged>>made from anArc<vec::IntoIter<_>>:size_hintthrough a clone, andget_mutrefused while a clone or aWeakshares it.nextthroughget_mutonce they drop, dropping that item.Arc.Rc<dyn ExactSizeIterator>and its upcast toRc<dyn Iterator>:len,get_mutrefused while shared, thennextandsize_hint.Arc::from(Box<dyn Iterator>)of the crate's own iterator, read byget_mutand then dropped.Weakcoerced from anRc<Countdown>, upgraded before and after it drops.Pin<Box<dyn Iterator + Unpin>>, read and dropped.Census at the moq pin, before → after: unchanged (542 / 86 / 70 for moq-net / model / kio), since moq builds none of these.
Impact
Alternatives
Arc::get_mutofdyn Iteratoralone: it is the same mapping for every trait object, so limiting it would leave the crate's own traits refused for no reason. Onlydyn Any's has a way back to the concrete value.Follow-ups
quest/m3/ts-dyn.mdnow holds onlydyn Error's downcasts, resized from [L] to [M]. Its goal no longer names&mut dyn Debug, which landed in #453.Arc::get_mutof adyn Anystays refused, as above.Review
Codex
gpt-6.1-solat medium effort, viaquest review, round 2 on head95458959956d7ccc24a98e47e65b39144422a197: no findings.Round 1 (head
402db123) reported one finding, refuted: callback ownership inffi/src/dart.rs, which is #472's code. #472 landed on main during the round and is outside this branch's diff.🤖 Generated with Claude Code