From f798804cd9612daa324c93d911eae00fa1775597 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 22 Nov 2019 13:31:47 +0100 Subject: Improve E0057 long error explanation --- src/librustc_error_codes/error_codes/E0057.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0057.md b/src/librustc_error_codes/error_codes/E0057.md index e11c07f835a..bb5e4b48d2d 100644 --- a/src/librustc_error_codes/error_codes/E0057.md +++ b/src/librustc_error_codes/error_codes/E0057.md @@ -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; @@ -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: ``` -- cgit 1.4.1-3-g733a5