Skip to content

bindgen! output for map<K, V> doesn't compile without wasmtime's std feature #14830

Open

Description

@jrandolf

bindgen! emits std::collections::HashMap<K, V> for map<K, V>, but Wasmtime only implements ComponentType/Lift/Lower for the HashMap behind its internal hash_map alias, which is hashbrown::HashMap when wasmtime's std feature is off. So any WIT using map fails to compile with, for example:

wasmtime = { version = "...", default-features = false, features = ["runtime", "component-model"] }
wasmtime::component::bindgen!({
    inline: "package a:b; interface i { f: func(m: map<string, u32>); } world w { import i; }",
});
error[E0277]: the trait `ComponentType` is not implemented for `HashMap<String, u32>`

The generated path also doesn't go through wasmtime_crate/__internal like Vec and String do, so it doesn't work from #![no_std] crates either. The existing codegen_no_std.rs test doesn't catch this since it re-adds extern crate std and builds wasmtime with default features.

Activity

  1. added a commit that references this issue on Oct 19, 2026
    f71f112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions