1 // priv-in-pub lint tests where the private type appears in the
2 // `where` clause of a public item
5 #![feature(generic_const_exprs)]
6 #![allow(incomplete_features)]
12 pub struct PubTyGeneric<T>(T);
14 impl PubTr for PrivTy {}
15 pub trait PubTrWithAssocTy { type AssocTy; }
16 impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
20 //~^ WARNING private type `PrivTy` in public interface
21 //~| WARNING hard error
28 //~^ WARNING private type `PrivTy` in public interface
29 //~| WARNING hard error
36 //~^ WARNING private type `PrivTy` in public interface
37 //~| WARNING hard error
44 //~^ ERROR private type `PrivTy` in public interface
49 //~^ WARNING private type `PrivTy` in public interface
50 //~| WARNING hard error
63 impl<T> PubTr for PubTyGeneric<T>
65 T: PubTrWithAssocTy<AssocTy=PrivTy>
69 pub struct Const<const U: u8>;
73 fn assoc_fn() -> Self::AssocTy;
76 impl<const U: u8> Trait for Const<U>
78 Const<{ my_const_fn(U) }>: ,
80 type AssocTy = Const<{ my_const_fn(U) }>;
81 //~^ ERROR private type
82 fn assoc_fn() -> Self::AssocTy {
87 const fn my_const_fn(val: u8) -> u8 {
88 // body of this function doesn't matter