Skip to content

Conversation

@rvolosatovs
Copy link
Member

Discovered this trying to generate bindings for an interface containing something like:

record test {
   rx: stream<u8>,
   tx: stream<u8>,
}

which failed with:

error[E0277]: the trait bound `StreamReader<u8>: Clone` is not satisfied
   --> crates/wasi-tls/src/p3/bindings.rs:5:5
    |
  5 | /     wasmtime::component::bindgen!({
  6 | |         path: "src/p3/wit",
  7 | |         world: "wasi:tls/imports",
  8 | |         imports: {
...   |
 14 | |         },
 15 | |     });
    | |______^ the trait `Clone` is not implemented for `StreamReader<u8>`

The change is fairly minimal and straightforward, so did not work on a test or anything like that.

I do not like this field name, but splitting into has_future and has_stream would require splitting also the TypeDefKind match cases (which are currently unified) and it did not quite feel right to include this in has_handle either.

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs requested a review from a team as a code owner December 11, 2025 18:55
@rvolosatovs rvolosatovs requested review from alexcrichton and removed request for a team December 11, 2025 18:55
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you add a test for this as well?

I think it would be reasonable to add Clone too, but I think that might require some careful handling on the runtime side of things as I don't think it's quite ready for clone/copy just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants