mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
add tests
This commit is contained in:
parent
13881f5404
commit
a7b114420c
@ -0,0 +1,30 @@
|
||||
//@ check-pass
|
||||
//@ revisions: ai ia ii
|
||||
//@ compile-flags: -Znext-solver=coherence
|
||||
|
||||
// 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<'a, T: ?Sized, U: ?Sized>(&'a (), *const T, *const U);
|
||||
trait Trait {
|
||||
type Assoc: ?Sized;
|
||||
}
|
||||
impl<'a, T: ?Sized + Trait> Trait for W<'a, T, T> {
|
||||
#[cfg(ai)]
|
||||
type Assoc = W<'a, T::Assoc, Id<T::Assoc>>;
|
||||
#[cfg(ia)]
|
||||
type Assoc = W<'a, Id<T::Assoc>, T::Assoc>;
|
||||
#[cfg(ii)]
|
||||
type Assoc = W<'a, Id<T::Assoc>, Id<T::Assoc>>;
|
||||
}
|
||||
|
||||
trait Overlap<T: ?Sized> {}
|
||||
impl<'a, T: ?Sized> Overlap<T> for W<'a, T, T> {}
|
||||
impl<T: ?Sized + Trait + NotImplemented> Overlap<T::Assoc> for T {}
|
||||
|
||||
fn main() {}
|
@ -1,6 +1,8 @@
|
||||
//@ check-pass
|
||||
//@ revisions: current next
|
||||
//[next]@ compile-flags: -Znext-solver
|
||||
//@ 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>.
|
||||
|
||||
@ -15,7 +17,12 @@ 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> {}
|
35
tests/ui/traits/next-solver/overflow/nalgebra-hang.rs
Normal file
35
tests/ui/traits/next-solver/overflow/nalgebra-hang.rs
Normal file
@ -0,0 +1,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() {}
|
Loading…
Reference in New Issue
Block a user