Skip to content

Commit

Permalink
Add test for old ICE in rust-lang#91594
Browse files Browse the repository at this point in the history
  • Loading branch information
BGR360 authored and Mark-Simulacrum committed Jan 28, 2022
1 parent 5b2747a commit 2819d90
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/ui/traits/issue-91594.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// #91594: This used to ICE.

trait Component<M> {
type Interface;
}
trait HasComponent<I> {}

struct Foo;

impl HasComponent<<Foo as Component<Foo>>::Interface> for Foo {}
//~^ ERROR the trait bound `Foo: HasComponent<()>` is not satisfied

impl<M: HasComponent<()>> Component<M> for Foo {
type Interface = u8;
}

fn main() {}
17 changes: 17 additions & 0 deletions src/test/ui/traits/issue-91594.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0277]: the trait bound `Foo: HasComponent<()>` is not satisfied
--> $DIR/issue-91594.rs:10:6
|
LL | impl HasComponent<<Foo as Component<Foo>>::Interface> for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo`
|
= help: the following implementations were found:
<Foo as HasComponent<<Foo as Component<Foo>>::Interface>>
note: required because of the requirements on the impl of `Component<Foo>` for `Foo`
--> $DIR/issue-91594.rs:13:27
|
LL | impl<M: HasComponent<()>> Component<M> for Foo {
| ^^^^^^^^^^^^ ^^^

error: aborting due to previous error

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

0 comments on commit 2819d90

Please sign in to comment.