I’ve got this code snippet:
//#1
trait S {
}
trait R<T> where T: S + Send + Clone {
}
fn main() {
let a : Box<dyn (S + Send)>;
}
the error is:
error: chained comparison operators require parentheses
--> src/main.rs:10:16
|
10 | let a : Box<dyn (S + Send)>;
| ^^^^^^^^^^^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
= help: or use `(...)` if you meant to specify fn arguments
error: expected one of `(`, `)`, `::`, or `<`, found `+`
--> src/main.rs:10:24
|
10 | let a : Box<dyn (S + Send)>;
| - ^ expected one of `(`, `)`, `::`, or `<` here
| |
| while parsing the type for `a`
and
// #2
trait S {
}
trait R<T> where T: S + Send + Clone {
}
fn main() {
let a : Box<(dyn S) + Send>;
}
the error is:
error[E0178]: expected a path on the left-hand side of `+`, not `(dyn S)`
--> src/main.rs:10:17
|
10 | let a : Box<(dyn S) + Send>;
| ^^^^^^^^^^^^^^ expected a path
error: aborting due to previous error
I think maybe one of these two is actually correct, but i’m not sure which one.