Stream: git-wasmtime

Topic: wasmtime / issue #14831 bindgen! takes anonymous map para...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:13):

jrandolf opened issue #14831:

For an exported function taking an anonymous map, e.g. f: func(m: map<string, list<string>>), bindgen! generates:

pub fn call_f<S: AsContextMut>(&self, store: S, arg0: HashMap<&str, &[String]>) -> ...

while for a named type named = map<string, string> it generates call_g(.., arg0: &Named).

The anonymous form means a caller holding a HashMap<String, Vec<String>> has to build (and hash) a second map of references just to make the call, and it's inconsistent with both named maps and lists (which are &[T]). Generating &HashMap<K, V> with owned keys and values, the way lists are handled, would fix both. Since this changes generated signatures it seems worth settling before map is enabled by default.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:21):

alexcrichton added the wasm-proposal:component-model-map label to Issue #14831.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 22:25):

alexcrichton closed issue #14831:

For an exported function taking an anonymous map, e.g. f: func(m: map<string, list<string>>), bindgen! generates:

pub fn call_f<S: AsContextMut>(&self, store: S, arg0: HashMap<&str, &[String]>) -> ...

while for a named type named = map<string, string> it generates call_g(.., arg0: &Named).

The anonymous form means a caller holding a HashMap<String, Vec<String>> has to build (and hash) a second map of references just to make the call, and it's inconsistent with both named maps and lists (which are &[T]). Generating &HashMap<K, V> with owned keys and values, the way lists are handled, would fix both. Since this changes generated signatures it seems worth settling before map is enabled by default.


Last updated: Oct 31 2026 at 23:03 UTC