You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bindgen! output for map<K, V> doesn't compile without wasmtime's std feature #14830
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
Use Wasmtime's own map type in bindgen! output