diff --git a/crates/component-macro/tests/codegen/direct-import.wit b/crates/component-macro/tests/codegen/direct-import.wit new file mode 100644 index 0000000000..d2b612d6de --- /dev/null +++ b/crates/component-macro/tests/codegen/direct-import.wit @@ -0,0 +1,3 @@ +default world foo { + import foo: func() +} diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs index 5e7e04f0e7..d02e883e7d 100644 --- a/crates/wit-bindgen/src/lib.rs +++ b/crates/wit-bindgen/src/lib.rs @@ -364,6 +364,9 @@ impl Wasmtime { } let world_camel = resolve.worlds[world].name.to_upper_camel_case(); + if self.opts.async_ { + uwriteln!(self.src, "#[wasmtime::component::__internal::async_trait]") + } uwriteln!(self.src, "pub trait {world_camel}Imports {{"); for sig in functions { self.src.push_str(sig);