]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/privacy-ns.rs
auto merge of #19514 : jbranchaud/rust/add-btree-set-bitor, r=Gankro
[rust.git] / src / test / run-pass / privacy-ns.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11
12 // Check we do the correct privacy checks when we import a name and there is an
13 // item with that name in both the value and type namespaces.
14
15 #![feature(globs)]
16 #![allow(dead_code)]
17 #![allow(unused_imports)]
18
19
20 // public type, private value
21 pub mod foo1 {
22     pub trait Bar {
23     }
24     pub struct Baz;
25
26     fn Bar() { }
27 }
28
29 fn test_unused1() {
30     use foo1::*;
31 }
32
33 fn test_single1() {
34     use foo1::Bar;
35
36     let _x: Box<Bar>;
37 }
38
39 fn test_list1() {
40     use foo1::{Bar,Baz};
41
42     let _x: Box<Bar>;
43 }
44
45 fn test_glob1() {
46     use foo1::*;
47
48     let _x: Box<Bar>;
49 }
50
51 // private type, public value
52 pub mod foo2 {
53     trait Bar {
54     }
55     pub struct Baz;
56
57     pub fn Bar() { }
58 }
59
60 fn test_unused2() {
61     use foo2::*;
62 }
63
64 fn test_single2() {
65     use foo2::Bar;
66
67     Bar();
68 }
69
70 fn test_list2() {
71     use foo2::{Bar,Baz};
72
73     Bar();
74 }
75
76 fn test_glob2() {
77     use foo2::*;
78
79     Bar();
80 }
81
82 // public type, public value
83 pub mod foo3 {
84     pub trait Bar {
85     }
86     pub struct Baz;
87
88     pub fn Bar() { }
89 }
90
91 fn test_unused3() {
92     use foo3::*;
93 }
94
95 fn test_single3() {
96     use foo3::Bar;
97
98     Bar();
99     let _x: Box<Bar>;
100 }
101
102 fn test_list3() {
103     use foo3::{Bar,Baz};
104
105     Bar();
106     let _x: Box<Bar>;
107 }
108
109 fn test_glob3() {
110     use foo3::*;
111
112     Bar();
113     let _x: Box<Bar>;
114 }
115
116 fn main() {
117 }
118