summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/private-in-public-ill-formed.rs
blob: 031e2874a2ba80db4f7ef9b564492fbfce77cb9d (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
mod aliases_pub {
    struct Priv;
    mod m {
        pub struct Pub3;
    }

    trait PrivTr {
        type AssocAlias;
    }
    impl PrivTr for Priv {
        type AssocAlias = m::Pub3;
    }

    impl <Priv as PrivTr>::AssocAlias {
        //~^ ERROR no nominal type found for inherent implementation
        pub fn f(arg: Priv) {} // private type `aliases_pub::Priv` in public interface
    }
}

mod aliases_priv {
    struct Priv;
    struct Priv3;

    trait PrivTr {
        type AssocAlias;
    }
    impl PrivTr for Priv {
        type AssocAlias = Priv3;
    }

    impl <Priv as PrivTr>::AssocAlias {
        //~^ ERROR no nominal type found for inherent implementation
        pub fn f(arg: Priv) {} // OK
    }
}

fn main() {}