]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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 { | |
9346a6ac | 10 | pub trait Bar { |
1a4d82fc JJ |
11 | } |
12 | pub struct Baz; | |
13 | ||
14 | fn Bar() { } | |
15 | } | |
16 | ||
17 | fn test_single1() { | |
5bcae85e | 18 | use foo1::Bar; |
1a4d82fc | 19 | |
e74abb32 | 20 | Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar` |
1a4d82fc JJ |
21 | } |
22 | ||
23 | fn test_list1() { | |
5bcae85e | 24 | use foo1::{Bar,Baz}; |
1a4d82fc | 25 | |
e74abb32 | 26 | Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar` |
1a4d82fc JJ |
27 | } |
28 | ||
29 | // private type, public value | |
30 | pub mod foo2 { | |
9346a6ac | 31 | trait Bar { |
1a4d82fc JJ |
32 | } |
33 | pub struct Baz; | |
34 | ||
35 | pub fn Bar() { } | |
36 | } | |
37 | ||
38 | fn test_single2() { | |
5bcae85e | 39 | use foo2::Bar; |
1a4d82fc | 40 | |
fc512014 | 41 | let _x : Box<Bar>; //~ ERROR constant provided when a type was expected |
e74abb32 | 42 | let _x : Bar(); //~ ERROR expected type, found function `Bar` |
1a4d82fc JJ |
43 | } |
44 | ||
45 | fn test_list2() { | |
5bcae85e | 46 | use foo2::{Bar,Baz}; |
1a4d82fc | 47 | |
fc512014 | 48 | let _x: Box<Bar>; //~ ERROR constant provided when a type was expected |
1a4d82fc JJ |
49 | } |
50 | ||
51 | // neither public | |
52 | pub mod foo3 { | |
9346a6ac | 53 | trait Bar { |
1a4d82fc JJ |
54 | } |
55 | pub struct Baz; | |
56 | ||
57 | fn Bar() { } | |
58 | } | |
59 | ||
60 | fn test_unused3() { | |
61 | use foo3::Bar; //~ ERROR `Bar` is private | |
62 | } | |
63 | ||
64 | fn test_single3() { | |
65 | use foo3::Bar; //~ ERROR `Bar` is private | |
66 | ||
67 | Bar(); | |
68 | let _x: Box<Bar>; | |
69 | } | |
70 | ||
71 | fn test_list3() { | |
72 | use foo3::{Bar,Baz}; //~ ERROR `Bar` is private | |
73 | ||
74 | Bar(); | |
75 | let _x: Box<Bar>; | |
76 | } | |
77 | ||
78 | fn main() { | |
79 | } |