|
| 1 | +error: ambiguous `+` in a type |
| 2 | + --> $DIR/trait-object-delimiters.rs:3:13 |
| 3 | + | |
| 4 | +LL | fn foo1(_: &dyn Drop + AsRef<str>) {} |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(dyn Drop + AsRef<str>)` |
| 6 | + |
| 7 | +error: incorrect braces around trait bounds |
| 8 | + --> $DIR/trait-object-delimiters.rs:6:17 |
| 9 | + | |
| 10 | +LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {} |
| 11 | + | ^ ^ |
| 12 | + | |
| 13 | +help: remove the parentheses |
| 14 | + | |
| 15 | +LL | fn foo2(_: &dyn Drop + AsRef<str>) {} |
| 16 | + | -- -- |
| 17 | + |
| 18 | +error: expected parameter name, found `{` |
| 19 | + --> $DIR/trait-object-delimiters.rs:8:17 |
| 20 | + | |
| 21 | +LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} |
| 22 | + | ^ expected parameter name |
| 23 | + |
| 24 | +error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, lifetime, or path, found `{` |
| 25 | + --> $DIR/trait-object-delimiters.rs:8:17 |
| 26 | + | |
| 27 | +LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} |
| 28 | + | -^ expected one of 8 possible tokens |
| 29 | + | | |
| 30 | + | help: missing `,` |
| 31 | + |
| 32 | +error: expected identifier, found `<` |
| 33 | + --> $DIR/trait-object-delimiters.rs:12:17 |
| 34 | + | |
| 35 | +LL | fn foo4(_: &dyn <Drop + AsRef<str>>) {} |
| 36 | + | ^ expected identifier |
| 37 | + |
| 38 | +error: invalid `dyn` keyword |
| 39 | + --> $DIR/trait-object-delimiters.rs:14:25 |
| 40 | + | |
| 41 | +LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {} |
| 42 | + | ^^^ help: remove this keyword |
| 43 | + | |
| 44 | + = help: `dyn` is only needed at the start of a trait `+`-separated list |
| 45 | + |
| 46 | +error[E0225]: only auto traits can be used as additional traits in a trait object |
| 47 | + --> $DIR/trait-object-delimiters.rs:3:24 |
| 48 | + | |
| 49 | +LL | fn foo1(_: &dyn Drop + AsRef<str>) {} |
| 50 | + | ---- ^^^^^^^^^^ additional non-auto trait |
| 51 | + | | |
| 52 | + | first non-auto trait |
| 53 | + | |
| 54 | + = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}` |
| 55 | + = 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> |
| 56 | + |
| 57 | +error[E0224]: at least one trait is required for an object type |
| 58 | + --> $DIR/trait-object-delimiters.rs:8:13 |
| 59 | + | |
| 60 | +LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} |
| 61 | + | ^^^ |
| 62 | + |
| 63 | +error[E0225]: only auto traits can be used as additional traits in a trait object |
| 64 | + --> $DIR/trait-object-delimiters.rs:14:29 |
| 65 | + | |
| 66 | +LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {} |
| 67 | + | ---- ^^^^^^^^^^ additional non-auto trait |
| 68 | + | | |
| 69 | + | first non-auto trait |
| 70 | + | |
| 71 | + = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}` |
| 72 | + = 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> |
| 73 | + |
| 74 | +error: aborting due to 9 previous errors |
| 75 | + |
| 76 | +Some errors have detailed explanations: E0224, E0225. |
| 77 | +For more information about an error, try `rustc --explain E0224`. |
0 commit comments