Add test for old ICE in #91594

This commit is contained in:
Ben Reeves 2021-12-27 00:09:19 -06:00 committed by Mark Rousskov
parent 5b2747a3b9
commit 2819d9051c
2 changed files with 34 additions and 0 deletions

View file

@ -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() {}

View file

@ -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`.