]> git.lizzy.rs Git - rust.git/blob - src/test/ui/privacy/privacy-ns1.rs
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup
[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, 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
29     pub fn Bar() { }
30 }
31
32 fn 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
45     fn Bar() { }
46 }
47
48 fn 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
55 fn main() {
56 }