fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
9.1 KiB283 linesraw
1error[E0308]: mismatched types
2  --> $DIR/fn-or-tuple-struct-without-args.rs:29:20
3   |
4LL | fn foo(a: usize, b: usize) -> usize { a }
5   | ----------------------------------- function `foo` defined here
6...
7LL |     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}`
14help: use parentheses to call this function
15   |
16LL |     let _: usize = foo(/* usize */, /* usize */);
17   |                       ++++++++++++++++++++++++++
18
19error[E0308]: mismatched types
20  --> $DIR/fn-or-tuple-struct-without-args.rs:30:16
21   |
22LL | struct S(usize, usize);
23   | -------- `S` defines a struct constructor here, which should be called
24...
25LL |     let _: S = S;
26   |            -   ^ expected `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}`
32help: use parentheses to construct this tuple struct
33   |
34LL |     let _: S = S(/* usize */, /* usize */);
35   |                 ++++++++++++++++++++++++++
36
37error[E0308]: mismatched types
38  --> $DIR/fn-or-tuple-struct-without-args.rs:31:20
39   |
40LL | fn bar() -> usize { 42 }
41   | ----------------- function `bar` defined here
42...
43LL |     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}`
50help: use parentheses to call this function
51   |
52LL |     let _: usize = bar();
53   |                       ++
54
55error[E0308]: mismatched types
56  --> $DIR/fn-or-tuple-struct-without-args.rs:32:16
57   |
58LL | struct V();
59   | -------- `V` defines a struct constructor here, which should be called
60...
61LL |     let _: V = V;
62   |            -   ^ expected `V`, found struct constructor
63   |            |
64   |            expected due to this
65   |
66   = note:          expected struct `V`
67           found struct constructor `fn() -> V {V}`
68help: use parentheses to construct this tuple struct
69   |
70LL |     let _: V = V();
71   |                 ++
72
73error[E0308]: mismatched types
74  --> $DIR/fn-or-tuple-struct-without-args.rs:33:20
75   |
76LL |     fn baz(x: usize, y: usize) -> usize { x }
77   |     ----------------------------------- associated function `baz` defined here
78...
79LL |     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}`
86help: use parentheses to call this associated function
87   |
88LL |     let _: usize = T::baz(/* usize */, /* usize */);
89   |                          ++++++++++++++++++++++++++
90
91error[E0308]: mismatched types
92  --> $DIR/fn-or-tuple-struct-without-args.rs:34:20
93   |
94LL |     fn bat(x: usize) -> usize { 42 }
95   |     ------------------------- associated function `bat` defined here
96...
97LL |     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}`
104help: use parentheses to call this associated function
105   |
106LL |     let _: usize = T::bat(/* usize */);
107   |                          +++++++++++++
108
109error[E0308]: mismatched types
110  --> $DIR/fn-or-tuple-struct-without-args.rs:35:16
111   |
112LL |     A(usize),
113   |     - `A` defines an enum variant constructor here, which should be called
114...
115LL |     let _: E = E::A;
116   |            -   ^^^^ expected `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}`
122help: use parentheses to construct this tuple variant
123   |
124LL |     let _: E = E::A(/* usize */);
125   |                    +++++++++++++
126
127error[E0533]: expected value, found struct variant `E::B`
128  --> $DIR/fn-or-tuple-struct-without-args.rs:36:16
129   |
130LL |     let _: E = E::B;
131   |                ^^^^ not a value
132
133error[E0308]: mismatched types
134  --> $DIR/fn-or-tuple-struct-without-args.rs:37:20
135   |
136LL |     fn baz(x: usize, y: usize) -> usize { x }
137   |     ----------------------------------- associated function `baz` defined here
138...
139LL |     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}`
146help: use parentheses to call this associated function
147   |
148LL |     let _: usize = X::baz(/* usize */, /* usize */);
149   |                          ++++++++++++++++++++++++++
150
151error[E0308]: mismatched types
152  --> $DIR/fn-or-tuple-struct-without-args.rs:38:20
153   |
154LL |     fn bat(x: usize) -> usize { 42 }
155   |     ------------------------- associated function `bat` defined here
156...
157LL |     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}`
164help: use parentheses to call this associated function
165   |
166LL |     let _: usize = X::bat(/* usize */);
167   |                          +++++++++++++
168
169error[E0308]: mismatched types
170  --> $DIR/fn-or-tuple-struct-without-args.rs:39:20
171   |
172LL |     fn bax(x: usize) -> usize { 42 }
173   |     ------------------------- associated function `bax` defined here
174...
175LL |     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}`
182help: use parentheses to call this associated function
183   |
184LL |     let _: usize = X::bax(/* usize */);
185   |                          +++++++++++++
186
187error[E0308]: mismatched types
188  --> $DIR/fn-or-tuple-struct-without-args.rs:40:20
189   |
190LL |     fn bach(x: usize) -> usize;
191   |     --------------------------- associated function `bach` defined here
192...
193LL |     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}`
200help: use parentheses to call this associated function
201   |
202LL |     let _: usize = X::bach(/* usize */);
203   |                           +++++++++++++
204
205error[E0308]: mismatched types
206  --> $DIR/fn-or-tuple-struct-without-args.rs:41:20
207   |
208LL |     fn ban(&self) -> usize { 42 }
209   |     ---------------------- method `ban` defined here
210...
211LL |     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}`
218help: use parentheses to call this method
219   |
220LL |     let _: usize = X::ban(/* &X */);
221   |                          ++++++++++
222
223error[E0308]: mismatched types
224  --> $DIR/fn-or-tuple-struct-without-args.rs:42:20
225   |
226LL |     fn bal(&self) -> usize;
227   |     ----------------------- method `bal` defined here
228...
229LL |     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}`
236help: use parentheses to call this method
237   |
238LL |     let _: usize = X::bal(/* &X */);
239   |                          ++++++++++
240
241error[E0615]: attempted to take value of method `ban` on type `X`
242  --> $DIR/fn-or-tuple-struct-without-args.rs:43:22
243   |
244LL |     let _: usize = X.ban;
245   |                      ^^^ method, not a field
246   |
247help: use parentheses to call the method
248   |
249LL |     let _: usize = X.ban();
250   |                         ++
251
252error[E0615]: attempted to take value of method `bal` on type `X`
253  --> $DIR/fn-or-tuple-struct-without-args.rs:44:22
254   |
255LL |     let _: usize = X.bal;
256   |                      ^^^ method, not a field
257   |
258help: use parentheses to call the method
259   |
260LL |     let _: usize = X.bal();
261   |                         ++
262
263error[E0308]: mismatched types
264  --> $DIR/fn-or-tuple-struct-without-args.rs:46:20
265   |
266LL |     let closure = || 42;
267   |                   -- the found closure
268LL |     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}`
275help: use parentheses to call this closure
276   |
277LL |     let _: usize = closure();
278   |                           ++
279
280error: aborting due to 17 previous errors
281
282Some errors have detailed explanations: E0308, E0533, E0615.
283For more information about an error, try `rustc --explain E0308`.