]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0423.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0423.md
1 An identifier was used like a function name or a value was expected and the
2 identifier exists but it belongs to a different namespace.
3
4 Erroneous code example:
5
6 ```compile_fail,E0423
7 struct Foo { a: bool };
8
9 let f = Foo();
10 // error: expected function, tuple struct or tuple variant, found `Foo`
11 // `Foo` is a struct name, but this expression uses it like a function name
12 ```
13
14 Please verify you didn't misspell the name of what you actually wanted to use
15 here. Example:
16
17 ```
18 fn Foo() -> u32 { 0 }
19
20 let f = Foo(); // ok!
21 ```
22
23 It is common to forget the trailing `!` on macro invocations, which would also
24 yield this error:
25
26 ```compile_fail,E0423
27 println("");
28 // error: expected function, tuple struct or tuple variant,
29 // found macro `println`
30 // did you mean `println!(...)`? (notice the trailing `!`)
31 ```
32
33 Another case where this error is emitted is when a value is expected, but
34 something else is found:
35
36 ```compile_fail,E0423
37 pub mod a {
38     pub const I: i32 = 1;
39 }
40
41 fn h1() -> i32 {
42     a.I
43     //~^ ERROR expected value, found module `a`
44     // did you mean `a::I`?
45 }
46 ```