]> git.lizzy.rs Git - rust.git/blob - tests/ui/resolve/privacy-struct-ctor.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / resolve / privacy-struct-ctor.rs
1 // aux-build:privacy-struct-ctor.rs
2
3 extern crate privacy_struct_ctor as xcrate;
4
5 mod m {
6     pub struct S(u8);
7     pub struct S2 {
8         s: u8
9     }
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() {
18         n::Z;
19         //~^ ERROR tuple struct constructor `Z` is private
20         Z;
21         //~^ ERROR expected value, found struct `Z`
22     }
23 }
24
25 use m::S; // OK, only the type is imported
26 use m::S2; // OK, only the type is imported
27
28 fn main() {
29     m::S;
30     //~^ ERROR tuple struct constructor `S` is private
31     let _: S = m::S(2);
32     //~^ ERROR tuple struct constructor `S` is private
33     S;
34     //~^ ERROR expected value, found struct `S`
35     m::n::Z;
36     //~^ ERROR tuple struct constructor `Z` is private
37
38     S2;
39     //~^ ERROR expected value, found struct `S2`
40
41     xcrate::m::S;
42     //~^ ERROR tuple struct constructor `S` is private
43     xcrate::S;
44     //~^ ERROR expected value, found struct `xcrate::S`
45     xcrate::m::n::Z;
46     //~^ ERROR tuple struct constructor `Z` is private
47 }