Skip to content

Commit 865a328

Browse files
committed
Rollup merge of rust-lang#34379 - liigo:patch-11, r=GuillaumeGomez
Improve diagnostics E0425: `use` (public) name E0425: unresolved name
2 parents 35004b4 + 2d7bac7 commit 865a328

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)