fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
9.0 KiB291 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   |            -----   ^^^ expected `usize`, found fn item
23   |            |
24   |            expected due to this
25   |
26   = note: expected type `usize`
27           found fn item `fn(usize, usize) -> usize {foo}`
28help: use parentheses to call this function
29   |
30LL |     let _: usize = foo(a, b);
31   |                       ^^^^^^
32
33error[E0308]: mismatched types
34  --> $DIR/fn-or-tuple-struct-without-args.rs:30:16
35   |
36LL | struct S(usize, usize);
37   | ----------------------- fn(usize, usize) -> S {S} defined here
38...
39LL |     let _: S = S;
40   |            -   ^ expected struct `S`, found fn item
41   |            |
42   |            expected due to this
43   |
44   = note: expected struct `S`
45             found fn item `fn(usize, usize) -> S {S}`
46help: use parentheses to instantiate this tuple struct
47   |
48LL |     let _: S = S(_, _);
49   |                 ^^^^^^
50
51error[E0308]: mismatched types
52  --> $DIR/fn-or-tuple-struct-without-args.rs:31:20
53   |
54LL | fn bar() -> usize { 42 }
55   | ----------------- fn() -> usize {bar} defined here
56...
57LL |     let _: usize = bar;
58   |            -----   ^^^ expected `usize`, found fn item
59   |            |
60   |            expected due to this
61   |
62   = note: expected type `usize`
63           found fn item `fn() -> usize {bar}`
64help: use parentheses to call this function
65   |
66LL |     let _: usize = bar();
67   |                       ^^
68
69error[E0308]: mismatched types
70  --> $DIR/fn-or-tuple-struct-without-args.rs:32:16
71   |
72LL | struct V();
73   | ----------- fn() -> V {V} defined here
74...
75LL |     let _: V = V;
76   |            -   ^ expected struct `V`, found fn item
77   |            |
78   |            expected due to this
79   |
80   = note: expected struct `V`
81             found fn item `fn() -> V {V}`
82help: use parentheses to instantiate this tuple struct
83   |
84LL |     let _: V = V();
85   |                 ^^
86
87error[E0308]: mismatched types
88  --> $DIR/fn-or-tuple-struct-without-args.rs:33:20
89   |
90LL |     fn baz(x: usize, y: usize) -> usize { x }
91   |     ----------------------------------- fn(usize, usize) -> usize {<_ as T>::baz} defined here
92...
93LL |     let _: usize = T::baz;
94   |            -----   ^^^^^^ expected `usize`, found fn item
95   |            |
96   |            expected due to this
97   |
98   = note: expected type `usize`
99           found fn item `fn(usize, usize) -> usize {<_ as T>::baz}`
100help: use parentheses to call this function
101   |
102LL |     let _: usize = T::baz(x, y);
103   |                          ^^^^^^
104
105error[E0308]: mismatched types
106  --> $DIR/fn-or-tuple-struct-without-args.rs:34:20
107   |
108LL |     fn bat(x: usize) -> usize { 42 }
109   |     ------------------------- fn(usize) -> usize {<_ as T>::bat} defined here
110...
111LL |     let _: usize = T::bat;
112   |            -----   ^^^^^^ expected `usize`, found fn item
113   |            |
114   |            expected due to this
115   |
116   = note: expected type `usize`
117           found fn item `fn(usize) -> usize {<_ as T>::bat}`
118help: use parentheses to call this function
119   |
120LL |     let _: usize = T::bat(x);
121   |                          ^^^
122
123error[E0308]: mismatched types
124  --> $DIR/fn-or-tuple-struct-without-args.rs:35:16
125   |
126LL |     A(usize),
127   |     -------- fn(usize) -> E {E::A} defined here
128...
129LL |     let _: E = E::A;
130   |            -   ^^^^ expected enum `E`, found fn item
131   |            |
132   |            expected due to this
133   |
134   = note: expected enum `E`
135           found fn item `fn(usize) -> E {E::A}`
136help: use parentheses to instantiate this tuple variant
137   |
138LL |     let _: E = E::A(_);
139   |                    ^^^
140
141error[E0308]: mismatched types
142  --> $DIR/fn-or-tuple-struct-without-args.rs:37:20
143   |
144LL |     fn baz(x: usize, y: usize) -> usize { x }
145   |     ----------------------------------- fn(usize, usize) -> usize {<X as T>::baz} defined here
146...
147LL |     let _: usize = X::baz;
148   |            -----   ^^^^^^ expected `usize`, found fn item
149   |            |
150   |            expected due to this
151   |
152   = note: expected type `usize`
153           found fn item `fn(usize, usize) -> usize {<X as T>::baz}`
154help: use parentheses to call this function
155   |
156LL |     let _: usize = X::baz(x, y);
157   |                          ^^^^^^
158
159error[E0308]: mismatched types
160  --> $DIR/fn-or-tuple-struct-without-args.rs:38:20
161   |
162LL |     fn bat(x: usize) -> usize { 42 }
163   |     ------------------------- fn(usize) -> usize {<X as T>::bat} defined here
164...
165LL |     let _: usize = X::bat;
166   |            -----   ^^^^^^ expected `usize`, found fn item
167   |            |
168   |            expected due to this
169   |
170   = note: expected type `usize`
171           found fn item `fn(usize) -> usize {<X as T>::bat}`
172help: use parentheses to call this function
173   |
174LL |     let _: usize = X::bat(x);
175   |                          ^^^
176
177error[E0308]: mismatched types
178  --> $DIR/fn-or-tuple-struct-without-args.rs:39:20
179   |
180LL |     fn bax(x: usize) -> usize { 42 }
181   |     ------------------------- fn(usize) -> usize {<X as T>::bax} defined here
182...
183LL |     let _: usize = X::bax;
184   |            -----   ^^^^^^ expected `usize`, found fn item
185   |            |
186   |            expected due to this
187   |
188   = note: expected type `usize`
189           found fn item `fn(usize) -> usize {<X as T>::bax}`
190help: use parentheses to call this function
191   |
192LL |     let _: usize = X::bax(x);
193   |                          ^^^
194
195error[E0308]: mismatched types
196  --> $DIR/fn-or-tuple-struct-without-args.rs:40:20
197   |
198LL |     fn bach(x: usize) -> usize;
199   |     --------------------------- fn(usize) -> usize {<X as T>::bach} defined here
200...
201LL |     let _: usize = X::bach;
202   |            -----   ^^^^^^^ expected `usize`, found fn item
203   |            |
204   |            expected due to this
205   |
206   = note: expected type `usize`
207           found fn item `fn(usize) -> usize {<X as T>::bach}`
208help: use parentheses to call this function
209   |
210LL |     let _: usize = X::bach(x);
211   |                           ^^^
212
213error[E0308]: mismatched types
214  --> $DIR/fn-or-tuple-struct-without-args.rs:41:20
215   |
216LL |     fn ban(&self) -> usize { 42 }
217   |     ---------------------- for<'r> fn(&'r X) -> usize {<X as T>::ban} defined here
218...
219LL |     let _: usize = X::ban;
220   |            -----   ^^^^^^ expected `usize`, found fn item
221   |            |
222   |            expected due to this
223   |
224   = note: expected type `usize`
225           found fn item `for<'r> fn(&'r X) -> usize {<X as T>::ban}`
226help: use parentheses to call this function
227   |
228LL |     let _: usize = X::ban(_);
229   |                          ^^^
230
231error[E0308]: mismatched types
232  --> $DIR/fn-or-tuple-struct-without-args.rs:42:20
233   |
234LL |     fn bal(&self) -> usize;
235   |     ----------------------- for<'r> fn(&'r X) -> usize {<X as T>::bal} defined here
236...
237LL |     let _: usize = X::bal;
238   |            -----   ^^^^^^ expected `usize`, found fn item
239   |            |
240   |            expected due to this
241   |
242   = note: expected type `usize`
243           found fn item `for<'r> fn(&'r X) -> usize {<X as T>::bal}`
244help: use parentheses to call this function
245   |
246LL |     let _: usize = X::bal(_);
247   |                          ^^^
248
249error[E0615]: attempted to take value of method `ban` on type `X`
250  --> $DIR/fn-or-tuple-struct-without-args.rs:43:22
251   |
252LL |     let _: usize = X.ban;
253   |                      ^^^ method, not a field
254   |
255help: use parentheses to call the method
256   |
257LL |     let _: usize = X.ban();
258   |                         ^^
259
260error[E0615]: attempted to take value of method `bal` on type `X`
261  --> $DIR/fn-or-tuple-struct-without-args.rs:44:22
262   |
263LL |     let _: usize = X.bal;
264   |                      ^^^ method, not a field
265   |
266help: use parentheses to call the method
267   |
268LL |     let _: usize = X.bal();
269   |                         ^^
270
271error[E0308]: mismatched types
272  --> $DIR/fn-or-tuple-struct-without-args.rs:46:20
273   |
274LL |     let closure = || 42;
275   |                   ----- the found closure
276LL |     let _: usize = closure;
277   |            -----   ^^^^^^^ expected `usize`, found closure
278   |            |
279   |            expected due to this
280   |
281   = note: expected type `usize`
282           found closure `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:24]`
283help: use parentheses to call this closure
284   |
285LL |     let _: usize = closure();
286   |                           ^^
287
288error: aborting due to 17 previous errors
289
290Some errors have detailed explanations: E0308, E0423, E0615.
291For more information about an error, try `rustc --explain E0308`.