summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/issue-111220-tuple-struct-fields.rs
blob: 78d35fd96da3d5c93fabe8b35690ee865317e48a (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
mod b {
    #[derive(Default)]
    pub struct A(u32);
}

impl b::A {
    fn inherent_bypass(&self) {
        let Self(x) = self;
        //~^ ERROR: tuple struct constructor `A` is private
        println!("{x}");
    }
}

pub trait B {
    fn f(&self);
}

impl B for b::A {
    fn f(&self) {
        let Self(a) = self;
        //~^ ERROR: tuple struct constructor `A` is private
        println!("{}", a);
    }
}

pub trait Projector {
    type P;
}

impl Projector for () {
    type P = b::A;
}

pub trait Bypass2 {
    fn f2(&self);
}

impl Bypass2 for <() as Projector>::P {
    fn f2(&self) {
        let Self(a) = self;
        //~^ ERROR: tuple struct constructor `A` is private
        println!("{}", a);
    }
}

fn main() {}