summaryrefslogtreecommitdiffstats
path: root/src/test/ui/mismatched_types/closure-arg-count.stderr
blob: a02ec819838833dc2920fdc10ea9e5d380f97ba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
error[E0593]: closure is expected to take 2 arguments, but it takes 0 arguments
  --> $DIR/closure-arg-count.rs:5:15
   |
LL |     [1, 2, 3].sort_by(|| panic!());
   |               ^^^^^^^ -- takes 0 arguments
   |               |
   |               expected closure that takes 2 arguments
   |
help: consider changing the closure to take and ignore the expected arguments
   |
LL |     [1, 2, 3].sort_by(|_, _| panic!());
   |                       ~~~~~~

error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument
  --> $DIR/closure-arg-count.rs:7:15
   |
LL |     [1, 2, 3].sort_by(|tuple| panic!());
   |               ^^^^^^^ ------- takes 1 argument
   |               |
   |               expected closure that takes 2 arguments

error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
  --> $DIR/closure-arg-count.rs:9:15
   |
LL |     [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
   |               ^^^^^^^ ----------------- takes a single 2-tuple as argument
   |               |
   |               expected closure that takes 2 distinct arguments
   |
help: change the closure to take multiple arguments instead of a single tuple
   |
LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
   |                       ~~~~~~~~~~~~~~~

error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument
  --> $DIR/closure-arg-count.rs:11:15
   |
LL |     [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
   |               ^^^^^^^ ----------------------------- takes a single 2-tuple as argument
   |               |
   |               expected closure that takes 2 distinct arguments
   |
help: change the closure to take multiple arguments instead of a single tuple
   |
LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
   |                       ~~~~~~~~~~~~~~~

error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
  --> $DIR/closure-arg-count.rs:13:5
   |
LL |     f(|| panic!());
   |     ^ -- takes 0 arguments
   |     |
   |     expected closure that takes 1 argument
   |
note: required by a bound in `f`
  --> $DIR/closure-arg-count.rs:3:9
   |
LL | fn f<F: Fn<(usize,)>>(_: F) {}
   |         ^^^^^^^^^^^^ required by this bound in `f`
help: consider changing the closure to take and ignore the expected argument
   |
LL |     f(|_| panic!());
   |       ~~~

error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
  --> $DIR/closure-arg-count.rs:15:5
   |
LL |     f(  move    || panic!());
   |     ^   ---------- takes 0 arguments
   |     |
   |     expected closure that takes 1 argument
   |
note: required by a bound in `f`
  --> $DIR/closure-arg-count.rs:3:9
   |
LL | fn f<F: Fn<(usize,)>>(_: F) {}
   |         ^^^^^^^^^^^^ required by this bound in `f`
help: consider changing the closure to take and ignore the expected argument
   |
LL |     f(  move    |_| panic!());
   |                 ~~~

error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
  --> $DIR/closure-arg-count.rs:18:53
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
   |                                                     ^^^ ------ takes 2 distinct arguments
   |                                                     |
   |                                                     expected closure that takes a single 2-tuple as argument
   |
help: change the closure to accept a tuple instead of individual arguments
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
   |                                                         ~~~~~~~~

error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
  --> $DIR/closure-arg-count.rs:20:53
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
   |                                                     ^^^ ------------- takes 2 distinct arguments
   |                                                     |
   |                                                     expected closure that takes a single 2-tuple as argument
   |
help: change the closure to accept a tuple instead of individual arguments
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
   |                                                         ~~~~~~~~

error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
  --> $DIR/closure-arg-count.rs:22:53
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
   |                                                     ^^^ --------- takes 3 distinct arguments
   |                                                     |
   |                                                     expected closure that takes a single 2-tuple as argument

error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
  --> $DIR/closure-arg-count.rs:24:57
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
   |                                                     --- ^^^ expected function that takes a single 2-tuple as argument
   |                                                     |
   |                                                     required by a bound introduced by this call
...
LL | fn foo() {}
   | -------- takes 0 arguments
   |
note: required by a bound in `map`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
   |
LL |         F: FnMut(Self::Item) -> B,
   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`

error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
  --> $DIR/closure-arg-count.rs:27:57
   |
LL |     let bar = |i, x, y| i;
   |               --------- takes 3 distinct arguments
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
   |                                                     --- ^^^ expected closure that takes a single 2-tuple as argument
   |                                                     |
   |                                                     required by a bound introduced by this call
   |
note: required by a bound in `map`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
   |
LL |         F: FnMut(Self::Item) -> B,
   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`

error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
  --> $DIR/closure-arg-count.rs:29:57
   |
LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
   |                                                     --- ^^^ expected function that takes a single 2-tuple as argument
   |                                                     |
   |                                                     required by a bound introduced by this call
...
LL | fn qux(x: usize, y: usize) {}
   | -------------------------- takes 2 distinct arguments
   |
note: required by a bound in `map`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
   |
LL |         F: FnMut(Self::Item) -> B,
   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`

error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
  --> $DIR/closure-arg-count.rs:32:45
   |
LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
   |                                         --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
   |                                         |
   |                                         required by a bound introduced by this call
   |
note: required by a bound in `map`
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
   |
LL |         F: FnMut(Self::Item) -> B,
   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`

error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
  --> $DIR/closure-arg-count.rs:35:10
   |
LL |     call(Foo);
   |     ---- ^^^ expected function that takes 0 arguments
   |     |
   |     required by a bound introduced by this call
...
LL | struct Foo(u8);
   | ---------- takes 1 argument
   |
note: required by a bound in `call`
  --> $DIR/closure-arg-count.rs:42:30
   |
LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
   |                              ^^^^^^^^^^^^^ required by this bound in `call`

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0593`.