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
neptune
world use the original name of the interfacegreen
rather than the world's nameorange
.For comparison, the wit-bindgen guest bindings do appear to use the
orange
name.
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
green
should 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 orange
should be calledmod green
? Or do you think it's reasonable to rename thegreen
interface toorange
because of the worlds exports/imports?
sunfishcode commented on issue #5961:
Ah, I think I misspoke above. I'd expect it to have
mod orange
and 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
neptune
world use the original name of the interfacegreen
rather than the world's nameorange
.For comparison, the wit-bindgen guest bindings do appear to use the
orange
name.
Last updated: Dec 23 2024 at 12:05 UTC