summaryrefslogtreecommitdiffstats
path: root/src/test/ui/privacy/where-pub-type-impls-priv-trait.rs
blob: 87c211df16937d35ac5f1fc753f87026945e01c8 (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
// priv-in-pub lint tests where the private trait bounds a public type

#![crate_type = "lib"]
#![feature(generic_const_exprs)]
#![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
//~^ ERROR private trait `PrivTr` in public interface
where
    PubTy: PrivTr
{}


pub enum E
//~^ ERROR private trait `PrivTr` in public interface
where
    PubTy: PrivTr
{}


pub fn f()
//~^ ERROR private trait `PrivTr` in public interface
where
    PubTy: PrivTr
{}


impl S
//~^ ERROR private trait `PrivTr` in public interface
where
    PubTy: PrivTr
{
    pub fn f()
    //~^ ERROR private trait `PrivTr` in public interface
    where
        PubTy: PrivTr
    {}
}


impl PubTr for PubTy
where
    PubTy: PrivTr
{}