diff --git a/crates/wit-bindgen-rust/src/interface.rs b/crates/wit-bindgen-rust/src/interface.rs index da1f0818d..cfb863404 100644 --- a/crates/wit-bindgen-rust/src/interface.rs +++ b/crates/wit-bindgen-rust/src/interface.rs @@ -1795,7 +1795,7 @@ mod {mod_name} {{ .cloned() .collect(); if let Some(name) = self.name_of(id) { - let (paths, _) = async_paths_tyid(self.resolve, id); + let (paths, fut) = async_paths_tyid(self.resolve, id); self.rustdoc(docs); let mut derives = BTreeSet::new(); @@ -1807,13 +1807,13 @@ mod {mod_name} {{ { derives.extend(additional_derives.clone()); } - if info.is_copy() && paths.is_empty() { + if info.is_copy() && paths.is_empty() && !fut { derives.extend( ["::core::marker::Copy", "::core::clone::Clone"] .into_iter() .map(std::string::ToString::to_string), ); - } else if info.is_clone() && paths.is_empty() { + } else if info.is_clone() && paths.is_empty() && !fut { derives.insert("::core::clone::Clone".to_string()); } if !derives.is_empty() { @@ -1959,8 +1959,8 @@ mod {mod_name} {{ }}"#, ); } else { - let (paths, _) = async_paths_tyid(self.resolve, id); - if paths.is_empty() { + let (paths, fut) = async_paths_tyid(self.resolve, id); + if paths.is_empty() && !fut { uwrite!( self.src, r#" @@ -2010,7 +2010,7 @@ mod {mod_name} {{ ); let mut names = vec![format!("super::{name}")]; - if paths.is_empty() { + if paths.is_empty() && !fut { names.extend_from_slice(&[ format!("&super::{name}"), format!("&&super::{name}"), diff --git a/crates/wit-bindgen-test/src/rust.rs b/crates/wit-bindgen-test/src/rust.rs index 52fb02f76..fd2554d6b 100644 --- a/crates/wit-bindgen-test/src/rust.rs +++ b/crates/wit-bindgen-test/src/rust.rs @@ -68,14 +68,9 @@ impl LanguageMethods for Rust { if !args.is_empty() { return true; } - // The wRPC Rust generator does not yet support bare `stream`/`future` - // types, named fixed-length lists, or `map`. Other async constructs - // (`error-context`, futures/streams behind resources) generate - // successfully. - matches!( - name, - "streams.wit" | "futures.wit" | "named-fixed-length-list.wit" | "map.wit" - ) + // The wRPC Rust generator does not yet support named fixed-length + // lists or `map`. + matches!(name, "named-fixed-length-list.wit" | "map.wit") } fn codegen_test_variants(&self) -> &[(&str, &[&str])] {