Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve E0057 long error explanation
  • Loading branch information
GuillaumeGomez committed Nov 22, 2019
commit f798804cd9612daa324c93d911eae00fa1775597
10 changes: 6 additions & 4 deletions src/librustc_error_codes/error_codes/E0057.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
When invoking closures or other implementations of the function traits `Fn`,
`FnMut` or `FnOnce` using call notation, the number of parameters passed to the
function must match its definition.
An invalid number of arguments was given when calling a closure.

An example using a closure:
Erroneous code example:

```compile_fail,E0057
let f = |x| x * 3;
Expand All @@ -11,6 +9,10 @@ let b = f(4); // this works!
let c = f(2, 3); // invalid, too many parameters
```

When invoking closures or other implementations of the function traits `Fn`,
`FnMut` or `FnOnce` using call notation, the number of parameters passed to the
function must match its definition.

A generic function must be treated similarly:

```
Expand Down