]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/privacy-ns.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[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 // pretty-expanded FIXME #23616
16
17 #![allow(dead_code)]
18 #![allow(unused_imports)]
19
20
21 // public type, private value
22 pub mod foo1 {
23     pub trait Bar {
24         fn dummy(&self) { }
25     }
26     pub struct Baz;
27
28     fn Bar() { }
29 }
30
31 fn test_unused1() {
32     use foo1::*;
33 }
34
35 fn test_single1() {
36     use foo1::Bar;
37
38     let _x: Box<Bar>;
39 }
40
41 fn test_list1() {
42     use foo1::{Bar,Baz};
43
44     let _x: Box<Bar>;
45 }
46
47 fn test_glob1() {
48     use foo1::*;
49
50     let _x: Box<Bar>;
51 }
52
53 // private type, public value
54 pub mod foo2 {
55     trait Bar {
56         fn dummy(&self) { }
57     }
58     pub struct Baz;
59
60     pub fn Bar() { }
61 }
62
63 fn test_unused2() {
64     use foo2::*;
65 }
66
67 fn test_single2() {
68     use foo2::Bar;
69
70     Bar();
71 }
72
73 fn test_list2() {
74     use foo2::{Bar,Baz};
75
76     Bar();
77 }
78
79 fn test_glob2() {
80     use foo2::*;
81
82     Bar();
83 }
84
85 // public type, public value
86 pub mod foo3 {
87     pub trait Bar {
88         fn dummy(&self) { }
89     }
90     pub struct Baz;
91
92     pub fn Bar() { }
93 }
94
95 fn test_unused3() {
96     use foo3::*;
97 }
98
99 fn test_single3() {
100     use foo3::Bar;
101
102     Bar();
103     let _x: Box<Bar>;
104 }
105
106 fn test_list3() {
107     use foo3::{Bar,Baz};
108
109     Bar();
110     let _x: Box<Bar>;
111 }
112
113 fn test_glob3() {
114     use foo3::*;
115
116     Bar();
117     let _x: Box<Bar>;
118 }
119
120 fn main() {
121 }