error[E0308]: mismatched types
--> src/main.rs:16:5
|
7 | fn resolve() -> Shared<Pin<Box<dyn Future<Output = std::result::Result<String, String>>>>> {
| -------------------------------------------------------------------------- expected `Shared<Pin<Box<(dyn futures::Future<Output = Result<String, String>> + 'static)>>>` because of return type
...
16 | jh.boxed().shared()
| ^^^^^^^^^^^^^^^^^^^ expected trait `futures::Future<Output = Result<String, String>>`, found trait `futures::Future<Output = Result<_, String>> + std::marker::Send`
|
= note: expected struct `Shared<Pin<Box<(dyn futures::Future<Output = Result<String, String>> + 'static)>>>`
found struct `Shared<Pin<Box<dyn futures::Future<Output = Result<_, String>> + std::marker::Send>>>`
-Shared<Pin<Box<dyn Future<...
+Shared<Pin<Box<dyn Send + Future<...
According to the error, the Send bound is missing. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2c92f9e7de84ef528b479432ac45bbc4