]> git.proxmox.com Git - rustc.git/blob - tests/ui/traits/issue-78632.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / traits / issue-78632.rs
1 // check-pass
2 //
3 // Regression test for issue #78632
4
5 #![crate_type = "lib"]
6
7 pub trait Corge<T> {
8 type Fred;
9 }
10
11 impl Corge<u8> for () {
12 type Fred = u32;
13 }
14
15 pub trait Waldo {
16 type Quax;
17 }
18
19 impl Waldo for u32 {
20 type Quax = u8;
21 }
22
23 pub trait Grault
24 where
25 (): Corge<Self::Thud>,
26 {
27 type Thud;
28 fn bar(_: <() as Corge<Self::Thud>>::Fred) {}
29 }
30
31 impl<T> Grault for T
32 where
33 T: Waldo,
34 (): Corge<T::Quax>,
35 <() as Corge<T::Quax>>::Fred: Waldo,
36 {
37 type Thud = u8;
38 }
39
40 pub trait Plugh<I> {
41 fn baz();
42 }
43
44 #[derive(Copy, Clone, Debug)]
45 pub struct Qiz<T> {
46 foo: T,
47 }
48
49 impl<T> Plugh<<() as Corge<T::Thud>>::Fred> for Qiz<T>
50 where
51 T: Grault,
52 (): Corge<T::Thud>,
53 {
54 fn baz() {}
55 }
56
57 pub fn test() {
58 <Qiz<u32> as Plugh<u32>>::baz();
59 }