Skip to content

chore(lane): daily maintenance 2026-11-04 - #141

Merged
kirillDevPro merged 1 commit into
masterfrom
lane/daily-2026-11-04
Nov 4, 2026
Merged

kirillDevPro merged 1 commit into
masterfrom
lane/daily-2026-11-04

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

Hunt

Crate: moon-collections (VecMap).

  • Input: a VecMap whose key type has a Clone that panics; a vacant entry_ref(&k).or_insert(v) is caught with catch_unwind, then a new key is inserted through entry().
  • Wrong output: EntryRef::or_insert_with_key pushed the value before cloning the key, so the panicking clone left one value with no key. Every later key paired with its predecessor's value: iter() yielded [(1, "one"), (2, "lost")].
  • Expected output: [(1, "one"), (2, "two")]. VecMap documents itself as a drop-in replacement for std::collections::HashMap, whose entry API leaves the map unchanged when caller code panics mid-insert.
  • Fix: build the value and the cloned key before pushing either. Successful inserts are unchanged (the default still runs first, the key is still cloned exactly once).
  • Test: vecmap_tests::test_entry_ref_panicking_key_clone_leaves_map_unchanged fails on origin/master with the output above and passes now. Re-run: cargo test -p moon-collections panicking.
  • Reviewer: Codex (agree).

Quiet jobs

…e panics

Input: a VecMap whose key type has a Clone that panics; a vacant
entry_ref(&k).or_insert(v) is caught with catch_unwind, then a new key is
inserted through entry().

Wrong output: EntryRef::or_insert_with_key pushed the value before cloning
the key, so the panicking clone left one value with no key. Every key
inserted afterwards paired with its predecessor's value: iter() yielded
[(1, "one"), (2, "lost")].

Expected output: [(1, "one"), (2, "two")]. The type documents itself as a
drop-in replacement for std::collections::HashMap, whose entry API leaves
the map unchanged when caller code panics mid-insert. The fix builds the
value and the cloned key before pushing either; successful inserts are
unchanged (default still runs first, the key is still cloned once).

Test: vecmap_tests::test_entry_ref_panicking_key_clone_leaves_map_unchanged
fails on origin/master with the output above and passes now.
Re-run: cargo test -p moon-collections panicking

Reviewed by Codex (verdict: agree).
@kirillDevPro
kirillDevPro merged commit 7835765 into master Nov 4, 2026
4 checks passed
@kirillDevPro
kirillDevPro deleted the lane/daily-2026-11-04 branch November 4, 2026 05:16
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