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