]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/bound/not-on-struct.stderr
Auto merge of #81732 - m-ou-se:inherit-overflow-checks, r=Mark-Simulacrum
[rust.git] / src / test / ui / traits / bound / not-on-struct.stderr
1 error[E0226]: only a single explicit lifetime bound is permitted
2   --> $DIR/not-on-struct.rs:25:25
3    |
4 LL | fn e() -> 'static + A + 'static {
5    |                         ^^^^^^^
6
7 error[E0226]: only a single explicit lifetime bound is permitted
8   --> $DIR/not-on-struct.rs:29:53
9    |
10 LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
11    |                                                     ^^
12
13 error[E0404]: expected trait, found struct `Foo`
14   --> $DIR/not-on-struct.rs:8:16
15    |
16 LL | fn foo(_x: Box<Foo + Send>) { }
17    |                ^^^ not a trait
18    |
19 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
20   --> $DIR/not-on-struct.rs:8:22
21    |
22 LL | fn foo(_x: Box<Foo + Send>) { }
23    |                ---   ^^^^ ...because of this bound
24    |                |
25    |                expected this type to be a trait...
26
27 error[E0404]: expected trait, found struct `Vec`
28   --> $DIR/not-on-struct.rs:10:29
29    |
30 LL | type TypeAlias<T> = Box<dyn Vec<T>>;
31    |                             ^^^^^^ not a trait
32
33 error[E0404]: expected trait, found struct `A`
34   --> $DIR/not-on-struct.rs:13:11
35    |
36 LL | fn a() -> A + 'static {
37    |           ^ not a trait
38    |
39 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
40   --> $DIR/not-on-struct.rs:13:15
41    |
42 LL | fn a() -> A + 'static {
43    |           -   ^^^^^^^ ...because of this bound
44    |           |
45    |           expected this type to be a trait...
46 help: if you meant to use a type and not a trait here, remove the bounds
47    |
48 LL | fn a() -> A {
49    |           --
50
51 error[E0404]: expected trait, found enum `Result`
52   --> $DIR/not-on-struct.rs:16:34
53    |
54 LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
55    |                                  ^^^^^^^^^^^ not a trait
56    |
57 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
58   --> $DIR/not-on-struct.rs:16:48
59    |
60 LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
61    |                                  -----------   ^^ ...because of this bound
62    |                                  |
63    |                                  expected this type to be a trait...
64 help: if you meant to use a type and not a trait here, remove the bounds
65    |
66 LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
67    |                                            --
68
69 error[E0404]: expected trait, found struct `A`
70   --> $DIR/not-on-struct.rs:19:21
71    |
72 LL | fn c() -> 'static + A {
73    |                     ^ not a trait
74    |
75 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
76   --> $DIR/not-on-struct.rs:19:11
77    |
78 LL | fn c() -> 'static + A {
79    |           ^^^^^^^   - expected this type to be a trait...
80    |           |
81    |           ...because of this bound
82 help: if you meant to use a type and not a trait here, remove the bounds
83    |
84 LL | fn c() -> A {
85    |          --
86
87 error[E0404]: expected trait, found enum `Result`
88   --> $DIR/not-on-struct.rs:22:39
89    |
90 LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
91    |                                       ^^^^^^^^^^^ not a trait
92    |
93 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
94   --> $DIR/not-on-struct.rs:22:34
95    |
96 LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
97    |                                  ^^   ----------- expected this type to be a trait...
98    |                                  |
99    |                                  ...because of this bound
100 help: if you meant to use a type and not a trait here, remove the bounds
101    |
102 LL | fn d<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
103    |                                 --
104
105 error[E0404]: expected trait, found struct `A`
106   --> $DIR/not-on-struct.rs:25:21
107    |
108 LL | fn e() -> 'static + A + 'static {
109    |                     ^ not a trait
110    |
111 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
112   --> $DIR/not-on-struct.rs:25:11
113    |
114 LL | fn e() -> 'static + A + 'static {
115    |           ^^^^^^^   -   ^^^^^^^ ...because of these bounds
116    |                     |
117    |                     expected this type to be a trait...
118 help: if you meant to use a type and not a trait here, remove the bounds
119    |
120 LL | fn e() -> A {
121    |          ---
122
123 error[E0404]: expected trait, found enum `Result`
124   --> $DIR/not-on-struct.rs:29:39
125    |
126 LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
127    |                                       ^^^^^^^^^^^ not a trait
128    |
129 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
130   --> $DIR/not-on-struct.rs:29:34
131    |
132 LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
133    |                                  ^^   -----------   ^^ ...because of these bounds
134    |                                       |
135    |                                       expected this type to be a trait...
136 help: if you meant to use a type and not a trait here, remove the bounds
137    |
138 LL | fn f<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
139    |                                 --         --
140
141 error[E0404]: expected trait, found struct `Traitor`
142   --> $DIR/not-on-struct.rs:35:11
143    |
144 LL | trait Trait {}
145    | ----------- similarly named trait `Trait` defined here
146 LL | fn g() -> Traitor + 'static {
147    |           ^^^^^^^ not a trait
148    |
149 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
150   --> $DIR/not-on-struct.rs:35:21
151    |
152 LL | fn g() -> Traitor + 'static {
153    |           -------   ^^^^^^^ ...because of this bound
154    |           |
155    |           expected this type to be a trait...
156 help: if you meant to use a type and not a trait here, remove the bounds
157    |
158 LL | fn g() -> Traitor {
159    |                 --
160 help: a trait with a similar name exists
161    |
162 LL | fn g() -> Trait + 'static {
163    |           ^^^^^
164
165 error: aborting due to 11 previous errors
166
167 Some errors have detailed explanations: E0226, E0404.
168 For more information about an error, try `rustc --explain E0226`.