]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_error_codes/src/error_codes/E0425.md
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0425.md
1 An unresolved name was used.
2
3 Erroneous code examples:
4
5 ```compile_fail,E0425
6 something_that_doesnt_exist::foo;
7 // error: unresolved name `something_that_doesnt_exist::foo`
8
9 // or:
10
11 trait Foo {
12 fn bar() {
13 Self; // error: unresolved name `Self`
14 }
15 }
16
17 // or:
18
19 let x = unknown_variable; // error: unresolved name `unknown_variable`
20 ```
21
22 Please verify that the name wasn't misspelled and ensure that the
23 identifier being referred to is valid for the given situation. Example:
24
25 ```
26 enum something_that_does_exist {
27 Foo,
28 }
29 ```
30
31 Or:
32
33 ```
34 mod something_that_does_exist {
35 pub static foo : i32 = 0i32;
36 }
37
38 something_that_does_exist::foo; // ok!
39 ```
40
41 Or:
42
43 ```
44 let unknown_variable = 12u32;
45 let x = unknown_variable; // ok!
46 ```
47
48 If the item is not defined in the current module, it must be imported using a
49 `use` statement, like so:
50
51 ```
52 # mod foo { pub fn bar() {} }
53 # fn main() {
54 use foo::bar;
55 bar();
56 # }
57 ```
58
59 If the item you are importing is not defined in some super-module of the
60 current module, then it must also be declared as public (e.g., `pub fn`).