sunfishcode opened issue #5961:
This wit:
interface red { use self.green.{thing} foo: func() -> thing } interface green { type thing = s32 } default world neptune { import blue: self.red import orange: self.green }with this Rust:
wasmtime::component::bindgen!({ path: "test.wit", }); fn main() {}gets this error:
error[E0433]: failed to resolve: could not find `green` in the crate root --> src/main.rs:1:1 | 1 | / wasmtime::component::bindgen!({ 2 | | path: "a.wit", 3 | | }); | |__^ could not find `green` in the crate root |It appears the bindgen-generated bindings for the
neptuneworld use the original name of the interfacegreenrather than the world's nameorange.For comparison, the wit-bindgen guest bindings do appear to use the
orangename.
sunfishcode commented on issue #5961:
The cargo expand code has
pub mod orange { ... }pub mod blue { ... pub type Thing = super::green::Thing; ... }That reference to
greenshould be renamed to a reference toorange.
alexcrichton commented on issue #5961:
I think this would be reasonable enough to fix as-is, but I'll also take the opportunity to ask, would you expect something different to be generated here? For example do you think that
mod orangeshould be calledmod green? Or do you think it's reasonable to rename thegreeninterface toorangebecause of the worlds exports/imports?
sunfishcode commented on issue #5961:
Ah, I think I misspoke above. I'd expect it to have
mod orangeand reference orange, because the bindings are generated for a world, and not for interfaces in isolation. Inside the world here, the name is orange, so it should be orange in the bindings.
alexcrichton commented on issue #5961:
Oh no worries, just wanted to confirm! I think https://github.com/bytecodealliance/wasmtime/pull/5968 should fix this
alexcrichton closed issue #5961:
This wit:
interface red { use self.green.{thing} foo: func() -> thing } interface green { type thing = s32 } default world neptune { import blue: self.red import orange: self.green }with this Rust:
wasmtime::component::bindgen!({ path: "test.wit", }); fn main() {}gets this error:
error[E0433]: failed to resolve: could not find `green` in the crate root --> src/main.rs:1:1 | 1 | / wasmtime::component::bindgen!({ 2 | | path: "a.wit", 3 | | }); | |__^ could not find `green` in the crate root |It appears the bindgen-generated bindings for the
neptuneworld use the original name of the interfacegreenrather than the world's nameorange.For comparison, the wit-bindgen guest bindings do appear to use the
orangename.
Last updated: Dec 13 2025 at 19:03 UTC