]> git.lizzy.rs Git - rust.git/blob - src/test/ui/privacy/where-pub-type-impls-priv-trait.rs
Auto merge of #93718 - thomcc:used-macho, r=pnkfelix
[rust.git] / src / test / ui / privacy / where-pub-type-impls-priv-trait.rs
1 // priv-in-pub lint tests where the private trait bounds a public type
2
3 #![crate_type = "lib"]
4 #![feature(generic_const_exprs)]
5 #![allow(incomplete_features)]
6
7
8 struct PrivTy;
9 trait PrivTr {}
10 pub struct PubTy;
11 pub struct PubTyGeneric<T>(T);
12 pub trait PubTr {}
13 impl PubTr for PrivTy {}
14 impl PrivTr for PubTy {}
15 pub trait PubTrWithAssocTy { type AssocTy; }
16 impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
17
18
19 pub struct S
20 //~^ ERROR private trait `PrivTr` in public interface
21 where
22     PubTy: PrivTr
23 {}
24
25
26 pub enum E
27 //~^ ERROR private trait `PrivTr` in public interface
28 where
29     PubTy: PrivTr
30 {}
31
32
33 pub fn f()
34 //~^ ERROR private trait `PrivTr` in public interface
35 where
36     PubTy: PrivTr
37 {}
38
39
40 impl S
41 //~^ ERROR private trait `PrivTr` in public interface
42 where
43     PubTy: PrivTr
44 {
45     pub fn f()
46     //~^ ERROR private trait `PrivTr` in public interface
47     where
48         PubTy: PrivTr
49     {}
50 }
51
52
53 impl PubTr for PubTy
54 where
55     PubTy: PrivTr
56 {}