]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_error_codes/src/error_codes/E0593.md
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0593.md
1 You tried to supply an `Fn`-based type with an incorrect number of arguments
2 than what was expected.
3
4 Erroneous code example:
5
6 ```compile_fail,E0593
7 fn foo<F: Fn()>(x: F) { }
8
9 fn main() {
10 // [E0593] closure takes 1 argument but 0 arguments are required
11 foo(|y| { });
12 }
13 ```
14
15 You have to provide the same number of arguments as expected by the `Fn`-based
16 type. So to fix the previous example, we need to remove the `y` argument:
17
18 ```
19 fn foo<F: Fn()>(x: F) { }
20
21 fn main() {
22 foo(|| { }); // ok!
23 }
24 ```