From 2d7bac7d865a3c77f2fb05b9505d81d068df5551 Mon Sep 17 00:00:00 2001 From: Liigo Zhuang Date: Mon, 20 Jun 2016 16:19:19 +0800 Subject: [PATCH] Improve diagnostics E0425: `use` (public) items E0425: unresolved name --- src/librustc_resolve/diagnostics.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 208b5f11e20d1..4e4f6e276d1dd 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -843,6 +843,17 @@ Or: let unknown_variable = 12u32; let x = unknown_variable; // ok! ``` + +If the item is not defined in the current module, it must be imported using a +`use` statement, like so: + +```ignore +use foo::bar; +bar(); +``` + +If the item you are importing is not defined in some super-module of the +current module, then it must also be declared as public (e.g., `pub fn`). "##, E0426: r##"