]>
Commit | Line | Data |
---|---|---|
8bb4bdeb XL |
1 | // aux-build:privacy-struct-ctor.rs |
2 | ||
8bb4bdeb XL |
3 | extern crate privacy_struct_ctor as xcrate; |
4 | ||
5 | mod m { | |
6 | pub struct S(u8); | |
2c00a5a8 XL |
7 | pub struct S2 { |
8 | s: u8 | |
9 | } | |
8bb4bdeb XL |
10 | |
11 | pub mod n { | |
12 | pub(in m) struct Z(pub(in m::n) u8); | |
13 | } | |
14 | ||
15 | use m::n::Z; // OK, only the type is imported | |
16 | ||
17 | fn f() { | |
2c00a5a8 | 18 | n::Z; |
e74abb32 | 19 | //~^ ERROR tuple struct constructor `Z` is private |
8bb4bdeb XL |
20 | Z; |
21 | //~^ ERROR expected value, found struct `Z` | |
8bb4bdeb XL |
22 | } |
23 | } | |
24 | ||
25 | use m::S; // OK, only the type is imported | |
2c00a5a8 | 26 | use m::S2; // OK, only the type is imported |
8bb4bdeb XL |
27 | |
28 | fn main() { | |
2c00a5a8 | 29 | m::S; |
e74abb32 | 30 | //~^ ERROR tuple struct constructor `S` is private |
2c00a5a8 | 31 | let _: S = m::S(2); |
e74abb32 | 32 | //~^ ERROR tuple struct constructor `S` is private |
8bb4bdeb XL |
33 | S; |
34 | //~^ ERROR expected value, found struct `S` | |
2c00a5a8 | 35 | m::n::Z; |
e74abb32 | 36 | //~^ ERROR tuple struct constructor `Z` is private |
2c00a5a8 XL |
37 | |
38 | S2; | |
39 | //~^ ERROR expected value, found struct `S2` | |
8bb4bdeb | 40 | |
2c00a5a8 | 41 | xcrate::m::S; |
e74abb32 | 42 | //~^ ERROR tuple struct constructor `S` is private |
8bb4bdeb XL |
43 | xcrate::S; |
44 | //~^ ERROR expected value, found struct `xcrate::S` | |
2c00a5a8 | 45 | xcrate::m::n::Z; |
e74abb32 | 46 | //~^ ERROR tuple struct constructor `Z` is private |
8bb4bdeb | 47 | } |