fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

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