From 46fe366756422b1a194b81f8ab8427f91abeca7c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 8 Feb 2023 11:16:40 -0600 Subject: [PATCH] Fix a missing `async_trait` annotation in `bindgen!` (#5747) Closes #5743 --- crates/component-macro/tests/codegen/direct-import.wit | 3 +++ crates/wit-bindgen/src/lib.rs | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 crates/component-macro/tests/codegen/direct-import.wit 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);