codegen fails to compile with indexmap 2.x in no_std + alloc mode
codegen fails to compile when indexmap is used without default features (i.e. no_std + alloc mode). In this configuration, IndexMap requires an explicit hasher type parameter and no longer provides IndexMap::new(). The current codegen source assumes std is always available, which breaks in no_std contexts.
Steps to Reproduce
-
Update
Cargo.tomldependency:[dependencies] indexmap = { version = "2.11", default-features = false } -
Build with nightly Rust:
cargo +nightly build
Observed Behavior
Compilation fails with errors such as:
error[E0107]: struct takes 3 generic arguments but 2 generic arguments were supplied error[E0599]: no function or associated item named `new` found for struct `IndexMap<K, V, S>`
Expected Behavior
codegen should compile successfully with indexmap in no_std + alloc mode by:
- Providing explicit
RandomStateor generic hasher arguments. - Replacing
IndexMap::new()withIndexMap::with_hasher(...).