1 error[E0308]: mismatched types
2 --> $DIR/fn-or-tuple-struct-without-args.rs:29:20
4 LL | fn foo(a: usize, b: usize) -> usize { a }
5 | ----------------------------------- function `foo` defined here
7 LL | let _: usize = foo;
8 | ----- ^^^ expected `usize`, found fn item
10 | expected due to this
12 = note: expected type `usize`
13 found fn item `fn(usize, usize) -> usize {foo}`
14 help: use parentheses to call this function
16 LL | let _: usize = foo(/* usize */, /* usize */);
17 | ++++++++++++++++++++++++++
19 error[E0308]: mismatched types
20 --> $DIR/fn-or-tuple-struct-without-args.rs:30:16
22 LL | struct S(usize, usize);
23 | -------- `S` defines a struct constructor here, which should be called
26 | - ^ expected `S`, found struct constructor
28 | expected due to this
30 = note: expected struct `S`
31 found struct constructor `fn(usize, usize) -> S {S}`
32 help: use parentheses to construct this tuple struct
34 LL | let _: S = S(/* usize */, /* usize */);
35 | ++++++++++++++++++++++++++
37 error[E0308]: mismatched types
38 --> $DIR/fn-or-tuple-struct-without-args.rs:31:20
40 LL | fn bar() -> usize { 42 }
41 | ----------------- function `bar` defined here
43 LL | let _: usize = bar;
44 | ----- ^^^ expected `usize`, found fn item
46 | expected due to this
48 = note: expected type `usize`
49 found fn item `fn() -> usize {bar}`
50 help: use parentheses to call this function
52 LL | let _: usize = bar();
55 error[E0308]: mismatched types
56 --> $DIR/fn-or-tuple-struct-without-args.rs:32:16
59 | -------- `V` defines a struct constructor here, which should be called
62 | - ^ expected `V`, found struct constructor
64 | expected due to this
66 = note: expected struct `V`
67 found struct constructor `fn() -> V {V}`
68 help: use parentheses to construct this tuple struct
73 error[E0308]: mismatched types
74 --> $DIR/fn-or-tuple-struct-without-args.rs:33:20
76 LL | fn baz(x: usize, y: usize) -> usize { x }
77 | ----------------------------------- associated function `baz` defined here
79 LL | let _: usize = T::baz;
80 | ----- ^^^^^^ expected `usize`, found fn item
82 | expected due to this
84 = note: expected type `usize`
85 found fn item `fn(usize, usize) -> usize {<_ as T>::baz}`
86 help: use parentheses to call this associated function
88 LL | let _: usize = T::baz(/* usize */, /* usize */);
89 | ++++++++++++++++++++++++++
91 error[E0308]: mismatched types
92 --> $DIR/fn-or-tuple-struct-without-args.rs:34:20
94 LL | fn bat(x: usize) -> usize { 42 }
95 | ------------------------- associated function `bat` defined here
97 LL | let _: usize = T::bat;
98 | ----- ^^^^^^ expected `usize`, found fn item
100 | expected due to this
102 = note: expected type `usize`
103 found fn item `fn(usize) -> usize {<_ as T>::bat}`
104 help: use parentheses to call this associated function
106 LL | let _: usize = T::bat(/* usize */);
109 error[E0308]: mismatched types
110 --> $DIR/fn-or-tuple-struct-without-args.rs:35:16
113 | - `A` defines an enum variant constructor here, which should be called
115 LL | let _: E = E::A;
116 | - ^^^^ expected `E`, found enum constructor
118 | expected due to this
120 = note: expected enum `E`
121 found enum constructor `fn(usize) -> E {E::A}`
122 help: use parentheses to construct this tuple variant
124 LL | let _: E = E::A(/* usize */);
127 error[E0533]: expected value, found struct variant `E::B`
128 --> $DIR/fn-or-tuple-struct-without-args.rs:36:16
130 LL | let _: E = E::B;
133 error[E0308]: mismatched types
134 --> $DIR/fn-or-tuple-struct-without-args.rs:37:20
136 LL | fn baz(x: usize, y: usize) -> usize { x }
137 | ----------------------------------- associated function `baz` defined here
139 LL | let _: usize = X::baz;
140 | ----- ^^^^^^ expected `usize`, found fn item
142 | expected due to this
144 = note: expected type `usize`
145 found fn item `fn(usize, usize) -> usize {<X as T>::baz}`
146 help: use parentheses to call this associated function
148 LL | let _: usize = X::baz(/* usize */, /* usize */);
149 | ++++++++++++++++++++++++++
151 error[E0308]: mismatched types
152 --> $DIR/fn-or-tuple-struct-without-args.rs:38:20
154 LL | fn bat(x: usize) -> usize { 42 }
155 | ------------------------- associated function `bat` defined here
157 LL | let _: usize = X::bat;
158 | ----- ^^^^^^ expected `usize`, found fn item
160 | expected due to this
162 = note: expected type `usize`
163 found fn item `fn(usize) -> usize {<X as T>::bat}`
164 help: use parentheses to call this associated function
166 LL | let _: usize = X::bat(/* usize */);
169 error[E0308]: mismatched types
170 --> $DIR/fn-or-tuple-struct-without-args.rs:39:20
172 LL | fn bax(x: usize) -> usize { 42 }
173 | ------------------------- associated function `bax` defined here
175 LL | let _: usize = X::bax;
176 | ----- ^^^^^^ expected `usize`, found fn item
178 | expected due to this
180 = note: expected type `usize`
181 found fn item `fn(usize) -> usize {<X as T>::bax}`
182 help: use parentheses to call this associated function
184 LL | let _: usize = X::bax(/* usize */);
187 error[E0308]: mismatched types
188 --> $DIR/fn-or-tuple-struct-without-args.rs:40:20
190 LL | fn bach(x: usize) -> usize;
191 | --------------------------- associated function `bach` defined here
193 LL | let _: usize = X::bach;
194 | ----- ^^^^^^^ expected `usize`, found fn item
196 | expected due to this
198 = note: expected type `usize`
199 found fn item `fn(usize) -> usize {<X as T>::bach}`
200 help: use parentheses to call this associated function
202 LL | let _: usize = X::bach(/* usize */);
205 error[E0308]: mismatched types
206 --> $DIR/fn-or-tuple-struct-without-args.rs:41:20
208 LL | fn ban(&self) -> usize { 42 }
209 | ---------------------- method `ban` defined here
211 LL | let _: usize = X::ban;
212 | ----- ^^^^^^ expected `usize`, found fn item
214 | expected due to this
216 = note: expected type `usize`
217 found fn item `for<'a> fn(&'a X) -> usize {<X as T>::ban}`
218 help: use parentheses to call this method
220 LL | let _: usize = X::ban(/* &X */);
223 error[E0308]: mismatched types
224 --> $DIR/fn-or-tuple-struct-without-args.rs:42:20
226 LL | fn bal(&self) -> usize;
227 | ----------------------- method `bal` defined here
229 LL | let _: usize = X::bal;
230 | ----- ^^^^^^ expected `usize`, found fn item
232 | expected due to this
234 = note: expected type `usize`
235 found fn item `for<'a> fn(&'a X) -> usize {<X as T>::bal}`
236 help: use parentheses to call this method
238 LL | let _: usize = X::bal(/* &X */);
241 error[E0615]: attempted to take value of method `ban` on type `X`
242 --> $DIR/fn-or-tuple-struct-without-args.rs:43:22
244 LL | let _: usize = X.ban;
245 | ^^^ method, not a field
247 help: use parentheses to call the method
249 LL | let _: usize = X.ban();
252 error[E0615]: attempted to take value of method `bal` on type `X`
253 --> $DIR/fn-or-tuple-struct-without-args.rs:44:22
255 LL | let _: usize = X.bal;
256 | ^^^ method, not a field
258 help: use parentheses to call the method
260 LL | let _: usize = X.bal();
263 error[E0308]: mismatched types
264 --> $DIR/fn-or-tuple-struct-without-args.rs:46:20
266 LL | let closure = || 42;
267 | -- the found closure
268 LL | let _: usize = closure;
269 | ----- ^^^^^^^ expected `usize`, found closure
271 | expected due to this
273 = note: expected type `usize`
274 found closure `{closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21}`
275 help: use parentheses to call this closure
277 LL | let _: usize = closure();
280 error: aborting due to 17 previous errors
282 Some errors have detailed explanations: E0308, E0533, E0615.
283 For more information about an error, try `rustc --explain E0308`.