Repository navigation
feat(ts): accept an empty iterator of mutable references as a place source - #497
Conversation
Quest-Claim: dfd60a80630f9b90
…ource Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe lowering code now recognizes empty iterators and default-empty linked-list iterators as lending no places. It also represents default linked-list iterators as iterators over an empty list. Language fixtures add chain and zip cases with empty iterators. Rejection fixtures remove the Merge Risk:
|
Problem
std::iter::empty::<&mut T>()for aTJS copies, as given toziporchain, was refused as "a mutable reference to a value JS copies, which its mapping would copy", though it yields nothing to write through.Default::default()of an empty iterator of places (iter::Empty, aLinkedList'sIterMutorIntoIter) was refused by the same check, as #362 noted when it leftIterMut::<u8>::default()in the reject fixture.Approach
std_placestreatsiter::emptyandDefault::defaultof an iterator whose default yields nothing as lending places, like a&mutcollection given tointo_iter.library::empty_defaultnames those iterators, sharing a newlist_itermatcher withdefault_value's list arm.refs::adaptedin the lang fixture chains and zipsiter::emptyon either side of a&mutVecandOptionof bytes, and chainsEmpty::default()and a list'sIterMutandIntoIterdefaults, differentially against native Rust. The reject fixture dropsIterMut::<u8>::default(), which now translates.Impact
Alternatives
iter::from_fnand similar make places in closures the check exists for.Follow-ups
None.
Review
Codex, gpt-6.1-sol, medium effort, round 1 on 18ab8cb: no findings. Since then, only conflict-free merges of origin/main (#492, #494, #463).
🤖 Generated with Claude Code