about summary refs log tree commit diff
path: root/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs
blob: 0d5f42231e4ada599422545732fb14698b9fe2b3 (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
//@ check-pass
//@ revisions: ai_current ai_next ia_current ia_next ii_current ii_next
//@[ai_next] compile-flags: -Znext-solver
//@[ia_next] compile-flags: -Znext-solver
//@[ii_next] compile-flags: -Znext-solver

// Regression test for nalgebra hang <https://github.com/rust-lang/rust/issues/130056>.

#![feature(lazy_type_alias)]
#![allow(incomplete_features)]

type Id<T: ?Sized> = T;
trait NotImplemented {}

struct W<T: ?Sized, U: ?Sized>(*const T, *const U);
trait Trait {
    type Assoc: ?Sized;
}
impl<T: ?Sized + Trait> Trait for W<T, T> {
    #[cfg(any(ai_current, ai_next))]
    type Assoc = W<T::Assoc, Id<T::Assoc>>;
    #[cfg(any(ia_current, ia_next))]
    type Assoc = W<Id<T::Assoc>, T::Assoc>;
    #[cfg(any(ii_current, ii_next))]
    type Assoc = W<Id<T::Assoc>, Id<T::Assoc>>;
}

trait Overlap<T: ?Sized> {}
impl<T: ?Sized> Overlap<T> for W<T, T> {}
impl<T: ?Sized + Trait + NotImplemented> Overlap<T::Assoc> for T {}

fn main() {}