fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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