when you use dyn trait object, currently you cannot add multiply trait bound for the trait object like
fn foo(_: Box<dyn Iterator<Item=()> + Debug>) {}
if you really want multiply trait bound, you can define a new trait
trait IteratorAndDebug: Iterator<Item=()> + Debugfn foo(_: Box<dyn IteratorAndDebug>) {}
But auto trait is an exception, you can add Sync and Send for dyn trait object and this is allowed
fn foo(_: Box<dyn Iterator<Item=()> + Sync + Send>) {}
➜ send_sync git:(master) ✗ cargo checkChecking send_sync v0.1.0 (/home/sean/data/code/github.com/xujihui1985/learningrust/send_sync)error[E0225]: only auto traits can be used as additional traits in a trait object--> src/main.rs:52:39|52 | fn foo(_: Box<dyn Iterator<Item=()> + std::fmt::Debug>) {| ----------------- ^^^^^^^^^^^^^^^ additional non-auto trait| || first non-auto trait|= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Iterator + Debug {}`= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>For more information about this error, try `rustc --explain E0225`.error: could not compile `send_sync` due to previous error
