1 // Check we do the correct privacy checks when we import a name and there is an 2 // item with that name in both the value and type namespaces. 3 4 #![allow(dead_code)] 5 #![allow(unused_imports)] 6 7 8 // public type, private value 9 pub mod foo1 { 10 pub trait Bar { 11 } 12 pub struct Baz; 13 Bar()14 fn Bar() { } 15 } 16 test_glob1()17fn test_glob1() { 18 use foo1::*; 19 20 Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar` 21 } 22 23 // private type, public value 24 pub mod foo2 { 25 trait Bar { 26 } 27 pub struct Baz; 28 Bar()29 pub fn Bar() { } 30 } 31 test_glob2()32fn test_glob2() { 33 use foo2::*; 34 35 let _x: Box<Bar>; 36 //~^ ERROR constant provided when a type was expected 37 } 38 39 // neither public 40 pub mod foo3 { 41 trait Bar { 42 } 43 pub struct Baz; 44 Bar()45 fn Bar() { } 46 } 47 test_glob3()48fn test_glob3() { 49 use foo3::*; 50 51 Bar(); //~ ERROR cannot find function, tuple struct or tuple variant `Bar` in this scope 52 let _x: Box<Bar>; //~ ERROR cannot find type `Bar` in this scope 53 } 54 main()55fn main() { 56 } 57