]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0618.md
Rollup merge of #76062 - pickfire:patch-13, r=jyn514
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0618.md
1 Attempted to call something which isn't a function nor a method.
2
3 Erroneous code examples:
4
5 ```compile_fail,E0618
6 enum X {
7     Entry,
8 }
9
10 X::Entry(); // error: expected function, tuple struct or tuple variant,
11             // found `X::Entry`
12
13 // Or even simpler:
14 let x = 0i32;
15 x(); // error: expected function, tuple struct or tuple variant, found `i32`
16 ```
17
18 Only functions and methods can be called using `()`. Example:
19
20 ```
21 // We declare a function:
22 fn i_am_a_function() {}
23
24 // And we call it:
25 i_am_a_function();
26 ```