]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/closure-arg-count.stderr
Rollup merge of #93024 - compiler-errors:inline-mir-bad-bounds, r=estebank
[rust.git] / src / test / ui / mismatched_types / closure-arg-count.stderr
1 error[E0593]: closure is expected to take 2 arguments, but it takes 0 arguments
2   --> $DIR/closure-arg-count.rs:5:15
3    |
4 LL |     [1, 2, 3].sort_by(|| panic!());
5    |               ^^^^^^^ -- takes 0 arguments
6    |               |
7    |               expected closure that takes 2 arguments
8    |
9 help: consider changing the closure to take and ignore the expected arguments
10    |
11 LL |     [1, 2, 3].sort_by(|_, _| panic!());
12    |                       ~~~~~~
13
14 error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument
15   --> $DIR/closure-arg-count.rs:7:15
16    |
17 LL |     [1, 2, 3].sort_by(|tuple| panic!());
18    |               ^^^^^^^ ------- takes 1 argument
19    |               |
20    |               expected closure that takes 2 arguments
21
22 error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
23   --> $DIR/closure-arg-count.rs:9:15
24    |
25 LL |     [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
26    |               ^^^^^^^ ----------------- takes a single 2-tuple as argument
27    |               |
28    |               expected closure that takes 2 distinct arguments
29    |
30 help: change the closure to take multiple arguments instead of a single tuple
31    |
32 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
33    |                       ~~~~~~~~~~~~~~~
34
35 error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
36   --> $DIR/closure-arg-count.rs:11:15
37    |
38 LL |     [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
39    |               ^^^^^^^ ----------------------------- takes a single 2-tuple as argument
40    |               |
41    |               expected closure that takes 2 distinct arguments
42    |
43 help: change the closure to take multiple arguments instead of a single tuple
44    |
45 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
46    |                       ~~~~~~~~~~~~~~~
47
48 error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
49   --> $DIR/closure-arg-count.rs:13:5
50    |
51 LL |     f(|| panic!());
52    |     ^ -- takes 0 arguments
53    |     |
54    |     expected closure that takes 1 argument
55    |
56 note: required by a bound in `f`
57   --> $DIR/closure-arg-count.rs:3:9
58    |
59 LL | fn f<F: Fn<usize>>(_: F) {}
60    |         ^^^^^^^^^ required by this bound in `f`
61 help: consider changing the closure to take and ignore the expected argument
62    |
63 LL |     f(|_| panic!());
64    |       ~~~
65
66 error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
67   --> $DIR/closure-arg-count.rs:15:5
68    |
69 LL |     f(  move    || panic!());
70    |     ^   ---------- takes 0 arguments
71    |     |
72    |     expected closure that takes 1 argument
73    |
74 note: required by a bound in `f`
75   --> $DIR/closure-arg-count.rs:3:9
76    |
77 LL | fn f<F: Fn<usize>>(_: F) {}
78    |         ^^^^^^^^^ required by this bound in `f`
79 help: consider changing the closure to take and ignore the expected argument
80    |
81 LL |     f(  move    |_| panic!());
82    |                 ~~~
83
84 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
85   --> $DIR/closure-arg-count.rs:18:53
86    |
87 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
88    |                                                     ^^^ ------ takes 2 distinct arguments
89    |                                                     |
90    |                                                     expected closure that takes a single 2-tuple as argument
91    |
92 help: change the closure to accept a tuple instead of individual arguments
93    |
94 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
95    |                                                         ~~~~~~~~
96
97 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
98   --> $DIR/closure-arg-count.rs:20:53
99    |
100 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
101    |                                                     ^^^ ------------- takes 2 distinct arguments
102    |                                                     |
103    |                                                     expected closure that takes a single 2-tuple as argument
104    |
105 help: change the closure to accept a tuple instead of individual arguments
106    |
107 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
108    |                                                         ~~~~~~~~
109
110 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
111   --> $DIR/closure-arg-count.rs:22:53
112    |
113 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
114    |                                                     ^^^ --------- takes 3 distinct arguments
115    |                                                     |
116    |                                                     expected closure that takes a single 2-tuple as argument
117
118 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
119   --> $DIR/closure-arg-count.rs:24:57
120    |
121 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
122    |                                                     --- ^^^ expected function that takes a single 2-tuple as argument
123    |                                                     |
124    |                                                     required by a bound introduced by this call
125 ...
126 LL | fn foo() {}
127    | -------- takes 0 arguments
128    |
129 note: required by a bound in `map`
130   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
131    |
132 LL |         F: FnMut(Self::Item) -> B,
133    |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
134
135 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
136   --> $DIR/closure-arg-count.rs:27:57
137    |
138 LL |     let bar = |i, x, y| i;
139    |               --------- takes 3 distinct arguments
140 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
141    |                                                     --- ^^^ expected closure that takes a single 2-tuple as argument
142    |                                                     |
143    |                                                     required by a bound introduced by this call
144    |
145 note: required by a bound in `map`
146   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
147    |
148 LL |         F: FnMut(Self::Item) -> B,
149    |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
150
151 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
152   --> $DIR/closure-arg-count.rs:29:57
153    |
154 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
155    |                                                     --- ^^^ expected function that takes a single 2-tuple as argument
156    |                                                     |
157    |                                                     required by a bound introduced by this call
158 ...
159 LL | fn qux(x: usize, y: usize) {}
160    | -------------------------- takes 2 distinct arguments
161    |
162 note: required by a bound in `map`
163   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
164    |
165 LL |         F: FnMut(Self::Item) -> B,
166    |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
167
168 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
169   --> $DIR/closure-arg-count.rs:32:45
170    |
171 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
172    |                                         --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
173    |                                         |
174    |                                         required by a bound introduced by this call
175    |
176 note: required by a bound in `map`
177   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
178    |
179 LL |         F: FnMut(Self::Item) -> B,
180    |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
181
182 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
183   --> $DIR/closure-arg-count.rs:35:10
184    |
185 LL |     call(Foo);
186    |     ---- ^^^ expected function that takes 0 arguments
187    |     |
188    |     required by a bound introduced by this call
189 ...
190 LL | struct Foo(u8);
191    | --------------- takes 1 argument
192    |
193 note: required by a bound in `call`
194   --> $DIR/closure-arg-count.rs:42:30
195    |
196 LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
197    |                              ^^^^^^^^^^^^^ required by this bound in `call`
198
199 error: aborting due to 14 previous errors
200
201 For more information about this error, try `rustc --explain E0593`.