Skip to content

Commit 2d7bac7

Browse files
committed
Improve diagnostics E0425: use (public) items
E0425: unresolved name
1 parent 6dcc2c1 commit 2d7bac7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/librustc_resolve/diagnostics.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,17 @@ Or:
843843
let unknown_variable = 12u32;
844844
let x = unknown_variable; // ok!
845845
```
846+
847+
If the item is not defined in the current module, it must be imported using a
848+
`use` statement, like so:
849+
850+
```ignore
851+
use foo::bar;
852+
bar();
853+
```
854+
855+
If the item you are importing is not defined in some super-module of the
856+
current module, then it must also be declared as public (e.g., `pub fn`).
846857
"##,
847858

848859
E0426: r##"

0 commit comments

Comments
 (0)