Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/wit-bindgen-rust/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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() {
Expand Down Expand Up @@ -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#"
Expand Down Expand Up @@ -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}"),
Expand Down
11 changes: 3 additions & 8 deletions crates/wit-bindgen-test/src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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])] {
Expand Down
Loading