Skip to content

Unify index assertions with new util functions - #448

Merged
cuviper merged 2 commits into
indexmap-rs:mainfrom
cuviper:assert_index
Aug 28, 2026
Merged

cuviper merged 2 commits into
indexmap-rs:mainfrom
cuviper:assert_index

Conversation

@cuviper

@cuviper cuviper commented Aug 28, 2026

Copy link
Copy Markdown
Member

This makes sure we use consistent messages for index bounds checks, without so much repetition.

This makes sure we use consistent messages for index bounds checks,
without so much repetition.
@cuviper
cuviper added this pull request to the merge queue Aug 28, 2026
Merged via the queue into indexmap-rs:main with commit b8a4187 Aug 28, 2026
16 checks passed
youdie006 added a commit to youdie006/indexmap that referenced this pull request Sep 15, 2026
PR indexmap-rs#448 unified the index assertions in this file, but Core::shift_insert_unique
kept a bare assert!(index <= end) and is the only index-taking Core method that
panics without #[track_caller]. That leaks through the public
VacantEntry::shift_insert, which panics with "assertion failed: index <= end"
located in indexmap's internals instead of the caller.

Also covers RawVacantEntryMut::shift_insert and shift_insert_hashed_nocheck,
which reach the same assertion.
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