]> git.lizzy.rs Git - rust.git/blob - src/test/ui/privacy/privacy-ns1.rs
update ui tests
[rust.git] / src / test / ui / privacy / privacy-ns1.rs
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
14     fn Bar() { }
15 }
16
17 fn test_glob1() {
18     use foo1::*;
19
20     Bar();  //~ ERROR expected function, found trait `Bar`
21 }
22
23 // private type, public value
24 pub mod foo2 {
25     trait Bar {
26     }
27     pub struct Baz;
28
29     pub fn Bar() { }
30 }
31
32 fn test_glob2() {
33     use foo2::*;
34
35     let _x: Box<Bar>;  //~ ERROR expected type, found function `Bar`
36 }
37
38 // neither public
39 pub mod foo3 {
40     trait Bar {
41     }
42     pub struct Baz;
43
44     fn Bar() { }
45 }
46
47 fn test_glob3() {
48     use foo3::*;
49
50     Bar();  //~ ERROR cannot find function `Bar` in this scope
51     let _x: Box<Bar>;  //~ ERROR cannot find type `Bar` in this scope
52 }
53
54 fn main() {
55 }