@@ -45,33 +45,41 @@ help: change the closure to take multiple arguments instead of a single tuple
45
45
LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!());
46
46
| ~~~~~~~~~~~~~~~
47
47
48
- error[E0308 ]: mismatched types
48
+ error[E0593 ]: closure is expected to take 1 argument, but it takes 0 arguments
49
49
--> $DIR/closure-arg-count.rs:13:5
50
50
|
51
51
LL | f(|| panic!());
52
- | ^ types differ
52
+ | ^ -- takes 0 arguments
53
+ | |
54
+ | expected closure that takes 1 argument
53
55
|
54
- = note: expected trait `Fn<usize>`
55
- found trait `Fn<()>`
56
56
note: required by a bound in `f`
57
57
--> $DIR/closure-arg-count.rs:3:9
58
58
|
59
- LL | fn f<F: Fn<usize>>(_: F) {}
60
- | ^^^^^^^^^ required by this bound in `f`
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
+ | ~~~
61
65
62
- error[E0308 ]: mismatched types
66
+ error[E0593 ]: closure is expected to take 1 argument, but it takes 0 arguments
63
67
--> $DIR/closure-arg-count.rs:15:5
64
68
|
65
69
LL | f( move || panic!());
66
- | ^ types differ
70
+ | ^ ---------- takes 0 arguments
71
+ | |
72
+ | expected closure that takes 1 argument
67
73
|
68
- = note: expected trait `Fn<usize>`
69
- found trait `Fn<()>`
70
74
note: required by a bound in `f`
71
75
--> $DIR/closure-arg-count.rs:3:9
72
76
|
73
- LL | fn f<F: Fn<usize>>(_: F) {}
74
- | ^^^^^^^^^ required by this bound in `f`
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
+ | ~~~
75
83
76
84
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
77
85
--> $DIR/closure-arg-count.rs:18:53
@@ -190,5 +198,4 @@ LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
190
198
191
199
error: aborting due to 14 previous errors
192
200
193
- Some errors have detailed explanations: E0308, E0593.
194
- For more information about an error, try `rustc --explain E0308`.
201
+ For more information about this error, try `rustc --explain E0593`.
0 commit comments