Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/ui/coherence/overlap-check-gat-alias-hang-151503.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/151503>.
//!
//! The overlap check for the two `MyFrom` impls used to hang.

trait HasAlias {}
struct Dummy;
trait DummyTrait {
type DummyType<T>;
}
impl DummyTrait for Dummy {
type DummyType<T> = T;
}
type AliasOf<T> = <Dummy as DummyTrait>::DummyType<T>;
struct Matrix<T, S>(T, S);
type OMatrix<T> = Matrix<T, AliasOf<T>>;

trait SimdValue {
type Element;
}
impl<T: HasAlias + SimdValue> SimdValue for OMatrix<T> {
type Element = OMatrix<T::Element>;
}
trait MyFrom<T> {}
impl<T> MyFrom<T> for T {}
impl<T: SimdValue> MyFrom<T> for OMatrix<T::Element> {}
//~^ ERROR conflicting implementations of trait `MyFrom<Matrix<_, _>>` for type `Matrix<_, _>`
impl<T, S> HasAlias for Matrix<T, S> {}

fn main() {}
11 changes: 11 additions & 0 deletions tests/ui/coherence/overlap-check-gat-alias-hang-151503.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0119]: conflicting implementations of trait `MyFrom<Matrix<_, _>>` for type `Matrix<_, _>`
--> $DIR/overlap-check-gat-alias-hang-151503.rs:25:1
|
LL | impl<T> MyFrom<T> for T {}
| ----------------------- first implementation here
LL | impl<T: SimdValue> MyFrom<T> for OMatrix<T::Element> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Matrix<_, _>`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0119`.
Loading