]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/issue-68295.rs
Rollup merge of #106144 - tgross35:patch-1, r=Mark-Simulacrum
[rust.git] / tests / ui / traits / issue-68295.rs
1 // check-fail
2 //
3 // regression test for #68295
4
5 struct Matrix<R, C, S>(R, C, S);
6
7 impl<R, C, S> Matrix<R, C, S> {
8     fn into_owned(self) -> Matrix<R, C, Owned<R, C, ()>>
9     where
10         (): Allocator<R, C>,
11     {
12         unimplemented!()
13     }
14 }
15
16 impl<D, S> Matrix<D, D, S> {
17     fn hermitian_part(&self) -> Matrix<D, D, Owned<D, D, ()>>
18     where
19         (): Allocator<D, D>,
20     {
21         unimplemented!()
22     }
23 }
24
25 trait Allocator<R, C> {
26     type Buffer;
27 }
28
29 trait Trait<R, C, A> {
30     type Power;
31 }
32
33 impl<R, C, A: Allocator<R, C>> Trait<R, C, A> for () {
34     type Power = A::Buffer;
35 }
36
37 type Owned<R, C, G> = <G as Trait<R, C, ()>>::Power;
38
39 fn crash<R, C>(input: Matrix<R, C, ()>) -> Matrix<R, C, u32>
40 where
41     (): Allocator<R, C>,
42 {
43     input.into_owned()
44     //~^ ERROR mismatched types [E0308]
45 }
46
47 fn main() {}