2021-05-03 23:48:56 -07:00
error: ambiguous `+` in a type
--> $DIR/trait-object-delimiters.rs:3:13
|
LL | fn foo1(_: &dyn Drop + AsRef<str>) {}
2024-07-06 03:07:46 +00:00
| ^^^^^^^^^^^^^^^^^^^^^
|
help: try adding parentheses
|
LL | fn foo1(_: &(dyn Drop + AsRef<str>)) {}
| + +
2021-05-03 23:48:56 -07:00
2023-08-14 17:51:19 +08:00
error: incorrect parentheses around trait bounds
2021-05-03 23:48:56 -07:00
--> $DIR/trait-object-delimiters.rs:6:17
|
LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {}
| ^ ^
|
2023-08-14 17:51:19 +08:00
help: fix the parentheses
2021-05-03 23:48:56 -07:00
|
2021-06-21 19:07:19 -07:00
LL - fn foo2(_: &dyn (Drop + AsRef<str>)) {}
2023-08-14 17:51:19 +08:00
LL + fn foo2(_: &(dyn Drop + AsRef<str>)) {}
2023-01-06 04:43:08 +09:00
|
2023-08-14 17:51:19 +08:00
error: incorrect parentheses around trait bounds
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:8:25
|
LL | fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
| ^ ^
|
2023-08-14 17:51:19 +08:00
help: fix the parentheses
2023-01-06 04:43:08 +09:00
|
LL - fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
2023-08-14 17:51:19 +08:00
LL + fn foo2_no_space(_: &(dyn Drop + AsRef<str>)) {}
2022-06-08 20:34:57 +03:00
|
2021-05-03 23:48:56 -07:00
error: expected parameter name, found `{`
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:10:17
2021-05-03 23:48:56 -07:00
|
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
| ^ expected parameter name
2024-06-05 16:18:52 -04:00
error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `async`, `const`, `for`, `use`, `~`, lifetime, or path, found `{`
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:10:17
2021-05-03 23:48:56 -07:00
|
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
2024-06-05 16:18:52 -04:00
| -^ expected one of 13 possible tokens
2021-05-03 23:48:56 -07:00
| |
| help: missing `,`
error: expected identifier, found `<`
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:14:17
2021-05-03 23:48:56 -07:00
|
LL | fn foo4(_: &dyn <Drop + AsRef<str>>) {}
| ^ expected identifier
error: invalid `dyn` keyword
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:16:25
2021-05-03 23:48:56 -07:00
|
LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
2024-07-06 03:07:46 +00:00
| ^^^
2021-05-03 23:48:56 -07:00
|
= help: `dyn` is only needed at the start of a trait `+`-separated list
2024-07-06 03:07:46 +00:00
help: remove this keyword
|
LL - fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
LL + fn foo5(_: &(dyn Drop + AsRef<str>)) {}
|
2021-05-03 23:48:56 -07:00
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-delimiters.rs:3:24
|
LL | fn foo1(_: &dyn Drop + AsRef<str>) {}
| ---- ^^^^^^^^^^ additional non-auto trait
| |
| first non-auto trait
|
2021-10-02 07:21:01 +07:00
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
2021-05-03 23:48:56 -07:00
= 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>
error[E0224]: at least one trait is required for an object type
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:10:13
2021-05-03 23:48:56 -07:00
|
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
| ^^^
error[E0225]: only auto traits can be used as additional traits in a trait object
2023-01-06 04:43:08 +09:00
--> $DIR/trait-object-delimiters.rs:16:29
2021-05-03 23:48:56 -07:00
|
LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
| ---- ^^^^^^^^^^ additional non-auto trait
| |
| first non-auto trait
|
2021-10-02 07:21:01 +07:00
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
2021-05-03 23:48:56 -07:00
= 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>
2023-01-06 04:43:08 +09:00
error: aborting due to 10 previous errors
2021-05-03 23:48:56 -07:00
Some errors have detailed explanations: E0224, E0225.
For more information about an error, try `rustc --explain E0224`.