@@ -60,8 +60,26 @@ help: consider changing the closure to take and ignore the expected argument
60
60
LL | f(|_| panic!());
61
61
| ^^^
62
62
63
+ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
64
+ --> $DIR/closure-arg-count.rs:25:5
65
+ |
66
+ LL | f( move || panic!());
67
+ | ^ ---------- takes 0 arguments
68
+ | |
69
+ | expected closure that takes 1 argument
70
+ |
71
+ note: required by `f`
72
+ --> $DIR/closure-arg-count.rs:13:1
73
+ |
74
+ LL | fn f<F: Fn<usize>>(_: F) {}
75
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
76
+ help: consider changing the closure to take and ignore the expected argument
77
+ |
78
+ LL | f( move |_| panic!());
79
+ | ^^^
80
+
63
81
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
64
- --> $DIR/closure-arg-count.rs:26 :53
82
+ --> $DIR/closure-arg-count.rs:28 :53
65
83
|
66
84
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
67
85
| ^^^ ------ takes 2 distinct arguments
@@ -73,7 +91,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
73
91
| ^^^^^^^^
74
92
75
93
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
76
- --> $DIR/closure-arg-count.rs:28 :53
94
+ --> $DIR/closure-arg-count.rs:30 :53
77
95
|
78
96
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
79
97
| ^^^ ------------- takes 2 distinct arguments
@@ -85,15 +103,15 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
85
103
| ^^^^^^^^
86
104
87
105
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
88
- --> $DIR/closure-arg-count.rs:30 :53
106
+ --> $DIR/closure-arg-count.rs:32 :53
89
107
|
90
108
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
91
109
| ^^^ --------- takes 3 distinct arguments
92
110
| |
93
111
| expected closure that takes a single 2-tuple as argument
94
112
95
113
error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
96
- --> $DIR/closure-arg-count.rs:32 :53
114
+ --> $DIR/closure-arg-count.rs:34 :53
97
115
|
98
116
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
99
117
| ^^^ expected function that takes a single 2-tuple as argument
@@ -102,15 +120,15 @@ LL | fn foo() {}
102
120
| -------- takes 0 arguments
103
121
104
122
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
105
- --> $DIR/closure-arg-count.rs:35 :53
123
+ --> $DIR/closure-arg-count.rs:37 :53
106
124
|
107
125
LL | let bar = |i, x, y| i;
108
126
| --------- takes 3 distinct arguments
109
127
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
110
128
| ^^^ expected closure that takes a single 2-tuple as argument
111
129
112
130
error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
113
- --> $DIR/closure-arg-count.rs:37 :53
131
+ --> $DIR/closure-arg-count.rs:39 :53
114
132
|
115
133
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
116
134
| ^^^ expected function that takes a single 2-tuple as argument
@@ -119,13 +137,13 @@ LL | fn qux(x: usize, y: usize) {}
119
137
| -------------------------- takes 2 distinct arguments
120
138
121
139
error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
122
- --> $DIR/closure-arg-count.rs:40 :41
140
+ --> $DIR/closure-arg-count.rs:42 :41
123
141
|
124
142
LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
125
143
| ^^^ expected function that takes 1 argument
126
144
127
145
error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
128
- --> $DIR/closure-arg-count.rs:43 :5
146
+ --> $DIR/closure-arg-count.rs:45 :5
129
147
|
130
148
LL | call(Foo);
131
149
| ^^^^ expected function that takes 0 arguments
@@ -134,11 +152,11 @@ LL | struct Foo(u8);
134
152
| --------------- takes 1 argument
135
153
|
136
154
note: required by `call`
137
- --> $DIR/closure-arg-count.rs:50 :1
155
+ --> $DIR/closure-arg-count.rs:52 :1
138
156
|
139
157
LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
140
158
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141
159
142
- error: aborting due to 13 previous errors
160
+ error: aborting due to 14 previous errors
143
161
144
162
For more information about this error, try `rustc --explain E0593`.
0 commit comments