]> git.lizzy.rs Git - rust.git/blob - src/test/ui/privacy/private-in-public-ill-formed.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / privacy / private-in-public-ill-formed.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 mod aliases_pub {
12     struct Priv;
13     mod m {
14         pub struct Pub3;
15     }
16
17     trait PrivTr {
18         type AssocAlias;
19     }
20     impl PrivTr for Priv {
21         type AssocAlias = m::Pub3;
22     }
23
24     impl <Priv as PrivTr>::AssocAlias { //~ ERROR no base type found for inherent implementation
25         pub fn f(arg: Priv) {} // private type `aliases_pub::Priv` in public interface
26     }
27 }
28
29 mod aliases_priv {
30     struct Priv;
31     struct Priv3;
32
33     trait PrivTr {
34         type AssocAlias;
35     }
36     impl PrivTr for Priv {
37         type AssocAlias = Priv3;
38     }
39
40     impl <Priv as PrivTr>::AssocAlias { //~ ERROR no base type found for inherent implementation
41         pub fn f(arg: Priv) {} // OK
42     }
43 }
44
45 fn main() {}