plabayo / tower-async

async fn(Input) -> Result<Output, Error>
MIT License
48 stars 1 forks source link

Service::call doesn't seem to implement Send trait bound #9

Closed GlenDC closed 1 year ago

GlenDC commented 1 year ago

Code such as the following pseudo code:

let service = make_service();
tokio::spawn(async move {
     let _ = service.call(req).await;
});

Currently doesn't compile, complaining that the Future generated for service::call call, does currently not implement Send, which is a requirement here, given we expect it to be Send for it to compile in a higher order fn.

GlenDC commented 1 year ago

Turns out to be a bug in the trait resolver. Which will be solved once that is complete. Using turbo fish syntax is for now how one can get around it.

Cfr: https://github.com/rust-lang/rust/issues/114142#issuecomment-1654600279

GlenDC commented 1 year ago

This issue can be closed as-is, given there's not much we can do or have to do, except to wait. For now tower-async users can make use of the "tubofish" syntax to get around it.