-
Notifications
You must be signed in to change notification settings - Fork 32
/
projections.rs
60 lines (47 loc) · 941 Bytes
/
projections.rs
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
57
58
59
60
mod m {
struct Priv;
pub type Leak = Priv; //~ WARN: `Priv` is more private than the item `Leak`
}
trait Trait {
type A<T>;
}
impl Trait for u8 {
type A<T> = u8;
}
fn check() -> <u8 as Trait>::A<m::Leak> {
//~^ ERROR: `Priv` is private
0
}
trait Trait2 {
type A<T>;
}
impl Trait2 for u8 {
type A<T> = m::Leak;
//~^ ERROR: `Priv` is private
//~| ERROR: private type `Priv` in public interface
}
fn check2() -> <u8 as Trait2>::A<u32> {
//~^ ERROR: `Priv` is private
todo!()
}
trait Trait3 {
type A<T: Trait>;
}
impl Trait3 for u8 {
type A<T: Trait> = T::A<m::Leak>;
//~^ ERROR: `Priv` is private
//~| ERROR: private type `Priv` in public interface
}
fn check3() -> <u8 as Trait3>::A<u8> {
todo!()
}
trait Trait4 {
type A<T: Trait3>;
}
impl Trait4 for u8 {
type A<T: Trait3> = T::A<u8>;
}
fn check4() -> <u8 as Trait4>::A<u8> {
todo!()
}
fn main() {}