Bindings generation with named-imports and unstable WIT features does not work
Author: alexcrichtonCreated Sep 14, 2026Updated Sep 14, 2026
Labelswasm-proposal:component-model
This example:
wasmtime::component::bindgen!({
inline: "
package wasmtime:test;
world test {
import a: wasi:sockets/[email protected];
}
",
path: "src/p2/wit",
world: "wasmtime:test/test",
with: {
"wasi:sockets/network": wasmtime_wasi::p2::bindings::sockets::network,
},
named_imports: {
"wasi:sockets/network": wasmtime_wasi::NamedId,
},
});fails with:
error[E0616]: field `network_error_code` of struct `wasmtime_wasi::p2::bindings::sockets::network::LinkOptions` is private
--> crates/wasi/tests/all/p2/async_.rs:580:1
|
580 | / wasmtime::component::bindgen!({
581 | | inline: "
582 | | package wasmtime:test;
... |
595 | | },
596 | | });
| |__^ private field
|
= note: this error originates in the macro `wasmtime::component::bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: a method `network_error_code` also exists, call it with parentheses
|
596 | })(_);Originally reported at https://github.com/bytecodealliance/wasmtime/pull/14275#pullrequestreview-5181298415
Source: bytecodealliance/wasmtime