4 // Like other items, private imports can be imported and used non-lexically in paths.
7 use self::foo::foo as bar;
14 mod foo { pub fn f() {} }
15 mod bar { pub fn f() {} }
17 pub fn f() -> bool { true }
19 // Items and explicit imports shadow globs.
23 fn f() -> bool { true }
34 // Here, there appears to be shadowing but isn't because of namespaces.
36 use foo::*; // This imports `f` in the value namespace.
37 use super::b as f; // This imports `f` only in the type namespace,
38 fn test() { self::f(); } // so the glob isn't shadowed.
41 // Here, there is shadowing in one namespace, but not the other.
47 use self::test::*; // This glob-imports `f` in both namespaces.
48 mod f { pub fn f() {} } // This shadows the glob only in the value namespace.
51 self::f(); // Check that the glob-imported value isn't shadowed.
52 self::f::f(); // Check that the glob-imported module is shadowed.
56 // Unused names can be ambiguous.
58 pub use foo::*; // This imports `f` in the value namespace.
59 pub use bar::*; // This also imports `f` in the value namespace.
63 pub use d::*; // n.b. Since `e::f` is not used, this is not considered to be a use of `d::f`.