It’s more helpful to see which types are dyn:
- Run
rustup component add cargo-fix and cargo fix --edition
- add
edition = "2018" to your Cargo toml,
- run
cargo fix --edition-idioms
When you’re working with an abstract type like dyn Trait, you get only what you ask for, and nothing more. Even if actual types you use it with support extra properties like Send/Sync, Rust pretends they don’t exist, because you didn’t ask for them to be guaranteed.
So to guarantee that every boxed future you could get is Send + Sync, you have to explicitly ask for it:
type Func = Box<dyn Fn(Vec<u8>) -> Box<dyn Future<Item = String, Error = ()> + Send + Sync> + Send + Sync>;
Note that you have two Box<dyn Trait> there, so you have to ask for Send/Sync for both.