]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/bound/not-on-struct.stderr
Rollup merge of #106570 - Xaeroxe:div-duration-tests, r=JohnTitor
[rust.git] / tests / 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 + 'static {
49 LL + fn a() -> A {
50    |
51
52 error[E0404]: expected trait, found enum `Result`
53   --> $DIR/not-on-struct.rs:16:34
54    |
55 LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
56    |                                  ^^^^^^^^^^^ not a trait
57    |
58 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
59   --> $DIR/not-on-struct.rs:16:48
60    |
61 LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
62    |                                  -----------   ^^ ...because of this bound
63    |                                  |
64    |                                  expected this type to be a trait...
65 help: if you meant to use a type and not a trait here, remove the bounds
66    |
67 LL - fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
68 LL + fn b<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
69    |
70
71 error[E0404]: expected trait, found struct `A`
72   --> $DIR/not-on-struct.rs:19:21
73    |
74 LL | fn c() -> 'static + A {
75    |                     ^ not a trait
76    |
77 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
78   --> $DIR/not-on-struct.rs:19:11
79    |
80 LL | fn c() -> 'static + A {
81    |           ^^^^^^^   - expected this type to be a trait...
82    |           |
83    |           ...because of this bound
84 help: if you meant to use a type and not a trait here, remove the bounds
85    |
86 LL - fn c() -> 'static + A {
87 LL + fn c() -> A {
88    |
89
90 error[E0404]: expected trait, found enum `Result`
91   --> $DIR/not-on-struct.rs:22:39
92    |
93 LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
94    |                                       ^^^^^^^^^^^ not a trait
95    |
96 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
97   --> $DIR/not-on-struct.rs:22:34
98    |
99 LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
100    |                                  ^^   ----------- expected this type to be a trait...
101    |                                  |
102    |                                  ...because of this bound
103 help: if you meant to use a type and not a trait here, remove the bounds
104    |
105 LL - fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
106 LL + fn d<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
107    |
108
109 error[E0404]: expected trait, found struct `A`
110   --> $DIR/not-on-struct.rs:25:21
111    |
112 LL | fn e() -> 'static + A + 'static {
113    |                     ^ not a trait
114    |
115 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
116   --> $DIR/not-on-struct.rs:25:11
117    |
118 LL | fn e() -> 'static + A + 'static {
119    |           ^^^^^^^   -   ^^^^^^^ ...because of these bounds
120    |                     |
121    |                     expected this type to be a trait...
122 help: if you meant to use a type and not a trait here, remove the bounds
123    |
124 LL - fn e() -> 'static + A + 'static {
125 LL + fn e() -> A {
126    |
127
128 error[E0404]: expected trait, found enum `Result`
129   --> $DIR/not-on-struct.rs:29:39
130    |
131 LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
132    |                                       ^^^^^^^^^^^ not a trait
133    |
134 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
135   --> $DIR/not-on-struct.rs:29:34
136    |
137 LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
138    |                                  ^^   -----------   ^^ ...because of these bounds
139    |                                       |
140    |                                       expected this type to be a trait...
141 help: if you meant to use a type and not a trait here, remove the bounds
142    |
143 LL - fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
144 LL + fn f<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
145    |
146
147 error[E0404]: expected trait, found struct `Traitor`
148   --> $DIR/not-on-struct.rs:35:11
149    |
150 LL | trait Trait {}
151    | ----------- similarly named trait `Trait` defined here
152 LL | fn g() -> Traitor + 'static {
153    |           ^^^^^^^ not a trait
154    |
155 help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
156   --> $DIR/not-on-struct.rs:35:21
157    |
158 LL | fn g() -> Traitor + 'static {
159    |           -------   ^^^^^^^ ...because of this bound
160    |           |
161    |           expected this type to be a trait...
162 help: if you meant to use a type and not a trait here, remove the bounds
163    |
164 LL - fn g() -> Traitor + 'static {
165 LL + fn g() -> Traitor {
166    |
167 help: a trait with a similar name exists
168    |
169 LL | fn g() -> Trait + 'static {
170    |           ~~~~~
171
172 error: aborting due to 11 previous errors
173
174 Some errors have detailed explanations: E0226, E0404.
175 For more information about an error, try `rustc --explain E0226`.