Skip to content

Upgrading indexmap 1 to 2

Breaking1.9.3 → 2.14.2Breaking7Platform4Deprecated2New42Changed15Fixed2Other4

BreakingUpgrade verdict

7 breaking changes and 4 platform requirement changes.

  • Removed the unnecessary Ord bound on insert_sorted_by methods.
  • If you turn off default features, you must now enable "std" yourself.
  • The old feature name for serde support is gone; use "serde" now.
  • Removed the internal rustc-rayon feature and dependency.
Top 5 of 13 that need code or config changes

Rust requirement changed in 2.14.0: 1.56 → 1.85.

Breaking7
Removed the unnecessary Ord bound on insert_sorted_by methods.
Ordinsert_sorted_by
The "std" feature is no longer auto-detected; it is in the default feature set or must be enabled explicitly.
std
Removes the "serde-1" feature; enable the optional "serde" dependency as a feature instead.
serde-1serde
Removed the internal rustc-rayon feature and dependency.
rustc-rayon
Corrected the signature of RawOccupiedEntryMut::into_key(self) -> &'a mut K, This a breaking change from 2.2.0, but that version was published for less than a day and has now been yanked.
IndexMap::get_index_mut now returns Option<(&K, &mut V)> instead of a mutable key; MutableKeys::get_index_mut2 keeps the old behavior.
IndexMap::get_index_mutMutableKeys::get_index_mut2
Moves the serde_seq module from the crate root to below the map module.
serde_seqmap
Platform4
MSRV: Rust 1.85.0 or later is now required.
MSRV: Rust 1.82.0 or later is now required.
Rust 1.63.0 is now supported as well, pending publication of hashbrown's relaxed MSRV or use of cargo --ignore-rust-version.
hashbrown--ignore-rust-version
Requires Rust 1.64.0 or later.
Deprecated2
Deprecated the borsh feature in favor of their own indexmap feature, solving a cyclic dependency that occurred via borsh-derive.
borshindexmapborsh-derive
Deprecates remove, remove_entry, and take in favor of shift_ or swap_ prefixed variants that are explicit about index and order effects.
removeremove_entrytakeshift_removeswap_removeshift_remove_entryswap_remove_entryshift_take