about summary refs log tree commit diff
path: root/tests/ui/traits/next-solver/overflow/nalgebra-hang.rs
blob: 4bc6039c57dfdd06e61350496e5234d39976fe4d (plain)
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
//@ check-pass
//@ revisions: current next
//@[next] compile-flags: -Znext-solver

// Regression test for nalgebra hang from
//     https://github.com/rust-lang/rust/pull/130654#issuecomment-2365465354
trait HasAlias {}

struct Dummy;
trait DummyTrait {
    type DummyType<T: HasAlias>;
}
impl DummyTrait for Dummy {
    type DummyType<T: HasAlias> = T;
}
type AliasOf<T> = <Dummy as DummyTrait>::DummyType<T>;

struct Matrix<T, S>(T, S);
type OMatrix<T> = Matrix<T, AliasOf<T>>;

impl<T: HasAlias> HasAlias for OMatrix<T> {}

trait SimdValue {
    type Element;
}
impl<T: HasAlias + SimdValue<Element: HasAlias>> SimdValue for OMatrix<T> {
    type Element = OMatrix<T::Element>;
}

trait Unimplemented {}
pub trait MyFrom<T> {}
impl<T: Unimplemented> MyFrom<T> for T {}
impl<T: SimdValue<Element: HasAlias>> MyFrom<T> for OMatrix<T::Element> {}

fn main() {}