-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
tests/ui/traits/next-solver/overflow/coherence-alias-hang-with-region.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |