summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/issue-79593.rs
blob: 39c222f7c3414c052fab7b5ecb4d55c93cd53a23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
mod foo {
    pub struct Pub { private: () }

    pub enum Enum {
        Variant { x: (), y: () },
        Other
    }

    fn correct() {
        Pub {};
        //~^ ERROR missing field `private` in initializer of `Pub`
        Enum::Variant { x: () };
        //~^ ERROR missing field `y` in initializer of `Enum`
    }
}

fn correct() {
    foo::Pub {};
    //~^ ERROR cannot construct `Pub` with struct literal syntax due to private fields
}

fn wrong() {
    foo::Enum::Variant { x: () };
    //~^ ERROR missing field `y` in initializer of `Enum`
    foo::Enum::Variant { };
    //~^ ERROR missing fields `x` and `y` in initializer of `Enum`
}

fn main() {}