about summary refs log tree commit diff
path: root/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
blob: 57548f75d5e49c83cdb8bdb243d1d26234776860 (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
47
48
49
50
51
52
53
54
55
56
//@ check-pass

// priv-in-pub lint tests where the private trait bounds a public type

#![crate_type = "lib"]
#![allow(incomplete_features)]

struct PrivTy;
trait PrivTr {}
pub struct PubTy;
pub struct PubTyGeneric<T>(T);
pub trait PubTr {}
impl PubTr for PrivTy {}
impl PrivTr for PubTy {}
pub trait PubTrWithAssocTy { type AssocTy; }
impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }


pub struct S
//~^ WARNING trait `PrivTr` is more private than the item `S`
where
    PubTy: PrivTr
{}


pub enum E
//~^ WARNING trait `PrivTr` is more private than the item `E`
where
    PubTy: PrivTr
{}


pub fn f()
//~^ WARNING trait `PrivTr` is more private than the item `f`
where
    PubTy: PrivTr
{}


impl S
//~^ WARNING trait `PrivTr` is more private than the item `S`
where
    PubTy: PrivTr
{
    pub fn f()
    //~^ WARNING trait `PrivTr` is more private than the item `S::f`
    where
        PubTy: PrivTr
    {}
}


impl PubTr for PubTy
where
    PubTy: PrivTr
{}