You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried this code from E0057 - invalid number of arguments was given when calling a closure:
// https://doc.rust-lang.org/error_codes/E0057.html#![allow(unused)]fnmain(){let f = |x| x *3;let a = f();// invalid, too few parameterslet b = f(4);// this works!let c = f(2,3);// invalid, too many parameters}
I expected to see this happen:
Give error like rustc:
error[E0057]: this function takes 1 argument but 0 arguments were supplied
--> <source>:4:9
|
4 | let a = f();// invalid, too few parameters
| ^-- supplied 0 arguments
| |
| expected 1 argument
error[E0057]: this function takes 1 argument but 2 arguments were supplied
--> <source>:6:9
|
6 | let c = f(2,3);// invalid, too many parameters
| ^ - - supplied 2 arguments
| |
| expected 1 argument
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0057`.Compiler returned:1
Instead, this happened:
Gives wrong and fatal error:
<source>:3:13: error: cannot apply this operator to types T? and <integer>
3 | let f = |x| x *3;
| ^
<source>:3:9: fatal error: unable to find lang item:'fn_once'3 | let f = |x| x *3;
| ^
compilation terminated.Compiler returned:1
Meta
What version of Rust GCC were you using, git sha 5406b63.
Godbolt version : gccrs (Compiler-Explorer-Build-gcc-2f91d511200bf85558c9013b09a458c06edd1e02-binutils-2.40) 13.0.1 20230417 (experimental)
The text was updated successfully, but these errors were encountered:
Unable to find lang item
(fatal-error)
compiler-explorer
I tried this code from
E0057
- invalid number of arguments was given when calling a closure:I expected to see this happen:
Instead, this happened:
wrong
andfatal error
:Meta
gccrs (Compiler-Explorer-Build-gcc-2f91d511200bf85558c9013b09a458c06edd1e02-binutils-2.40) 13.0.1 20230417 (experimental)
The text was updated successfully, but these errors were encountered: