File: trait-object-delimiters.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (100 lines) | stat: -rw-r--r-- 3,690 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
error: ambiguous `+` in a type
  --> $DIR/trait-object-delimiters.rs:3:13
   |
LL | fn foo1(_: &dyn Drop + AsRef<str>) {}
   |             ^^^^^^^^^^^^^^^^^^^^^
   |
help: try adding parentheses
   |
LL | fn foo1(_: &(dyn Drop + AsRef<str>)) {}
   |             +                     +

error: incorrect parentheses around trait bounds
  --> $DIR/trait-object-delimiters.rs:6:17
   |
LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {}
   |                 ^                 ^
   |
help: fix the parentheses
   |
LL - fn foo2(_: &dyn (Drop + AsRef<str>)) {}
LL + fn foo2(_: &(dyn Drop + AsRef<str>)) {}
   |

error: incorrect parentheses around trait bounds
  --> $DIR/trait-object-delimiters.rs:8:25
   |
LL | fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
   |                         ^                 ^
   |
help: fix the parentheses
   |
LL - fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
LL + fn foo2_no_space(_: &(dyn Drop + AsRef<str>)) {}
   |

error: expected parameter name, found `{`
  --> $DIR/trait-object-delimiters.rs:10:17
   |
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
   |                 ^ expected parameter name

error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `async`, `const`, `for`, `use`, `~`, lifetime, or path, found `{`
  --> $DIR/trait-object-delimiters.rs:10:17
   |
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
   |                -^ expected one of 13 possible tokens
   |                |
   |                help: missing `,`

error: expected identifier, found `<`
  --> $DIR/trait-object-delimiters.rs:14:17
   |
LL | fn foo4(_: &dyn <Drop + AsRef<str>>) {}
   |                 ^ expected identifier

error: invalid `dyn` keyword
  --> $DIR/trait-object-delimiters.rs:16:25
   |
LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
   |                         ^^^
   |
   = help: `dyn` is only needed at the start of a trait `+`-separated list
help: remove this keyword
   |
LL - fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
LL + fn foo5(_: &(dyn Drop + AsRef<str>)) {}
   |

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
   |
   = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
   = 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
  --> $DIR/trait-object-delimiters.rs:10:13
   |
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
   |             ^^^

error[E0225]: only auto traits can be used as additional traits in a trait object
  --> $DIR/trait-object-delimiters.rs:16:29
   |
LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
   |                  ----       ^^^^^^^^^^ 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: Drop + AsRef<str> {}`
   = 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: aborting due to 10 previous errors

Some errors have detailed explanations: E0224, E0225.
For more information about an error, try `rustc --explain E0224`.