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