fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
8.3 KiB239 linesraw
1error[E0423]: expected value, found struct variant `E::B`
2  --> $DIR/fn-or-tuple-struct-without-args.rs:36:16
3   |
4LL |     A(usize),
5   |     -------- similarly named tuple variant `A` defined here
6LL |     B { a: usize },
7   |     -------------- `E::B` defined here
8...
9LL |     let _: E = E::B;
10   |                ^^^-
11   |                |  |
12   |                |  help: a tuple variant with a similar name exists: `A`
13   |                did you mean `E::B { /* fields */ }`?
14
15error[E0308]: mismatched types
16  --> $DIR/fn-or-tuple-struct-without-args.rs:29:20
17   |
18LL | fn foo(a: usize, b: usize) -> usize { a }
19   | ----------------------------------- fn(usize, usize) -> usize {foo} defined here
20...
21LL |     let _: usize = foo;
22   |                    ^^^
23   |                    |
24   |                    expected usize, found fn item
25   |                    help: use parentheses to call this function: `foo(a, b)`
26   |
27   = note: expected type `usize`
28              found type `fn(usize, usize) -> usize {foo}`
29
30error[E0308]: mismatched types
31  --> $DIR/fn-or-tuple-struct-without-args.rs:30:16
32   |
33LL | struct S(usize, usize);
34   | ----------------------- fn(usize, usize) -> S {S} defined here
35...
36LL |     let _: S = S;
37   |                ^
38   |                |
39   |                expected struct `S`, found fn item
40   |                help: use parentheses to instantiate this tuple struct: `S(_, _)`
41   |
42   = note: expected type `S`
43              found type `fn(usize, usize) -> S {S}`
44
45error[E0308]: mismatched types
46  --> $DIR/fn-or-tuple-struct-without-args.rs:31:20
47   |
48LL | fn bar() -> usize { 42 }
49   | ----------------- fn() -> usize {bar} defined here
50...
51LL |     let _: usize = bar;
52   |                    ^^^
53   |                    |
54   |                    expected usize, found fn item
55   |                    help: use parentheses to call this function: `bar()`
56   |
57   = note: expected type `usize`
58              found type `fn() -> usize {bar}`
59
60error[E0308]: mismatched types
61  --> $DIR/fn-or-tuple-struct-without-args.rs:32:16
62   |
63LL | struct V();
64   | ----------- fn() -> V {V} defined here
65...
66LL |     let _: V = V;
67   |                ^
68   |                |
69   |                expected struct `V`, found fn item
70   |                help: use parentheses to instantiate this tuple struct: `V()`
71   |
72   = note: expected type `V`
73              found type `fn() -> V {V}`
74
75error[E0308]: mismatched types
76  --> $DIR/fn-or-tuple-struct-without-args.rs:33:20
77   |
78LL |     fn baz(x: usize, y: usize) -> usize { x }
79   |     ----------------------------------- fn(usize, usize) -> usize {<_ as T>::baz} defined here
80...
81LL |     let _: usize = T::baz;
82   |                    ^^^^^^
83   |                    |
84   |                    expected usize, found fn item
85   |                    help: use parentheses to call this function: `T::baz(x, y)`
86   |
87   = note: expected type `usize`
88              found type `fn(usize, usize) -> usize {<_ as T>::baz}`
89
90error[E0308]: mismatched types
91  --> $DIR/fn-or-tuple-struct-without-args.rs:34:20
92   |
93LL |     fn bat(x: usize) -> usize { 42 }
94   |     ------------------------- fn(usize) -> usize {<_ as T>::bat} defined here
95...
96LL |     let _: usize = T::bat;
97   |                    ^^^^^^
98   |                    |
99   |                    expected usize, found fn item
100   |                    help: use parentheses to call this function: `T::bat(x)`
101   |
102   = note: expected type `usize`
103              found type `fn(usize) -> usize {<_ as T>::bat}`
104
105error[E0308]: mismatched types
106  --> $DIR/fn-or-tuple-struct-without-args.rs:35:16
107   |
108LL |     A(usize),
109   |     -------- fn(usize) -> E {E::A} defined here
110...
111LL |     let _: E = E::A;
112   |                ^^^^
113   |                |
114   |                expected enum `E`, found fn item
115   |                help: use parentheses to instantiate this tuple variant: `E::A(_)`
116   |
117   = note: expected type `E`
118              found type `fn(usize) -> E {E::A}`
119
120error[E0308]: mismatched types
121  --> $DIR/fn-or-tuple-struct-without-args.rs:37:20
122   |
123LL |     fn baz(x: usize, y: usize) -> usize { x }
124   |     ----------------------------------- fn(usize, usize) -> usize {<X as T>::baz} defined here
125...
126LL |     let _: usize = X::baz;
127   |                    ^^^^^^
128   |                    |
129   |                    expected usize, found fn item
130   |                    help: use parentheses to call this function: `X::baz(x, y)`
131   |
132   = note: expected type `usize`
133              found type `fn(usize, usize) -> usize {<X as T>::baz}`
134
135error[E0308]: mismatched types
136  --> $DIR/fn-or-tuple-struct-without-args.rs:38:20
137   |
138LL |     fn bat(x: usize) -> usize { 42 }
139   |     ------------------------- fn(usize) -> usize {<X as T>::bat} defined here
140...
141LL |     let _: usize = X::bat;
142   |                    ^^^^^^
143   |                    |
144   |                    expected usize, found fn item
145   |                    help: use parentheses to call this function: `X::bat(x)`
146   |
147   = note: expected type `usize`
148              found type `fn(usize) -> usize {<X as T>::bat}`
149
150error[E0308]: mismatched types
151  --> $DIR/fn-or-tuple-struct-without-args.rs:39:20
152   |
153LL |     fn bax(x: usize) -> usize { 42 }
154   |     ------------------------- fn(usize) -> usize {<X as T>::bax} defined here
155...
156LL |     let _: usize = X::bax;
157   |                    ^^^^^^
158   |                    |
159   |                    expected usize, found fn item
160   |                    help: use parentheses to call this function: `X::bax(x)`
161   |
162   = note: expected type `usize`
163              found type `fn(usize) -> usize {<X as T>::bax}`
164
165error[E0308]: mismatched types
166  --> $DIR/fn-or-tuple-struct-without-args.rs:40:20
167   |
168LL |     fn bach(x: usize) -> usize;
169   |     --------------------------- fn(usize) -> usize {<X as T>::bach} defined here
170...
171LL |     let _: usize = X::bach;
172   |                    ^^^^^^^
173   |                    |
174   |                    expected usize, found fn item
175   |                    help: use parentheses to call this function: `X::bach(x)`
176   |
177   = note: expected type `usize`
178              found type `fn(usize) -> usize {<X as T>::bach}`
179
180error[E0308]: mismatched types
181  --> $DIR/fn-or-tuple-struct-without-args.rs:41:20
182   |
183LL |     fn ban(&self) -> usize { 42 }
184   |     ---------------------- for<'r> fn(&'r X) -> usize {<X as T>::ban} defined here
185...
186LL |     let _: usize = X::ban;
187   |                    ^^^^^^
188   |                    |
189   |                    expected usize, found fn item
190   |                    help: use parentheses to call this function: `X::ban(_)`
191   |
192   = note: expected type `usize`
193              found type `for<'r> fn(&'r X) -> usize {<X as T>::ban}`
194
195error[E0308]: mismatched types
196  --> $DIR/fn-or-tuple-struct-without-args.rs:42:20
197   |
198LL |     fn bal(&self) -> usize;
199   |     ----------------------- for<'r> fn(&'r X) -> usize {<X as T>::bal} defined here
200...
201LL |     let _: usize = X::bal;
202   |                    ^^^^^^
203   |                    |
204   |                    expected usize, found fn item
205   |                    help: use parentheses to call this function: `X::bal(_)`
206   |
207   = note: expected type `usize`
208              found type `for<'r> fn(&'r X) -> usize {<X as T>::bal}`
209
210error[E0615]: attempted to take value of method `ban` on type `X`
211  --> $DIR/fn-or-tuple-struct-without-args.rs:43:22
212   |
213LL |     let _: usize = X.ban;
214   |                      ^^^ help: use parentheses to call the method: `ban()`
215
216error[E0615]: attempted to take value of method `bal` on type `X`
217  --> $DIR/fn-or-tuple-struct-without-args.rs:44:22
218   |
219LL |     let _: usize = X.bal;
220   |                      ^^^ help: use parentheses to call the method: `bal()`
221
222error[E0308]: mismatched types
223  --> $DIR/fn-or-tuple-struct-without-args.rs:46:20
224   |
225LL |     let closure = || 42;
226   |                   -- closure defined here
227LL |     let _: usize = closure;
228   |                    ^^^^^^^
229   |                    |
230   |                    expected usize, found closure
231   |                    help: use parentheses to call this closure: `closure()`
232   |
233   = note: expected type `usize`
234              found type `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:24]`
235
236error: aborting due to 17 previous errors
237
238Some errors have detailed explanations: E0308, E0423, E0615.
239For more information about an error, try `rustc --explain E0308`.