]> git.lizzy.rs Git - rust.git/blob - tests/ui/privacy/privacy-ns.rs
Rollup merge of #103418 - Aaron1011:macro-semicolon-future-incompat, r=davidtwco
[rust.git] / tests / ui / privacy / privacy-ns.rs
1 // run-pass
2 #![allow(non_snake_case)]
3
4
5 // Check we do the correct privacy checks when we import a name and there is an
6 // item with that name in both the value and type namespaces.
7
8 // pretty-expanded FIXME #23616
9
10 #![allow(dead_code)]
11 #![allow(unused_imports)]
12
13
14 // public type, private value
15 pub mod foo1 {
16     pub trait Bar {
17         fn dummy(&self) { }
18     }
19     pub struct Baz;
20
21     fn Bar() { }
22 }
23
24 fn test_unused1() {
25     use foo1::*;
26 }
27
28 fn test_single1() {
29     use foo1::Bar;
30
31     let _x: Box<dyn Bar>;
32 }
33
34 fn test_list1() {
35     use foo1::{Bar,Baz};
36
37     let _x: Box<dyn Bar>;
38 }
39
40 fn test_glob1() {
41     use foo1::*;
42
43     let _x: Box<dyn Bar>;
44 }
45
46 // private type, public value
47 pub mod foo2 {
48     trait Bar {
49         fn dummy(&self) { }
50     }
51     pub struct Baz;
52
53     pub fn Bar() { }
54 }
55
56 fn test_unused2() {
57     use foo2::*;
58 }
59
60 fn test_single2() {
61     use foo2::Bar;
62
63     Bar();
64 }
65
66 fn test_list2() {
67     use foo2::{Bar,Baz};
68
69     Bar();
70 }
71
72 fn test_glob2() {
73     use foo2::*;
74
75     Bar();
76 }
77
78 // public type, public value
79 pub mod foo3 {
80     pub trait Bar {
81         fn dummy(&self) { }
82     }
83     pub struct Baz;
84
85     pub fn Bar() { }
86 }
87
88 fn test_unused3() {
89     use foo3::*;
90 }
91
92 fn test_single3() {
93     use foo3::Bar;
94
95     Bar();
96     let _x: Box<dyn Bar>;
97 }
98
99 fn test_list3() {
100     use foo3::{Bar,Baz};
101
102     Bar();
103     let _x: Box<dyn Bar>;
104 }
105
106 fn test_glob3() {
107     use foo3::*;
108
109     Bar();
110     let _x: Box<dyn Bar>;
111 }
112
113 fn main() {
114 }