Rollup merge of #86796 - JohnTitor:test-70703, r=jonas-schievink

Add a regression test for issue-70703

Closes #70703
This commit is contained in:
Yuki Okushi 2021-07-03 03:15:11 +09:00 committed by GitHub
commit f6ef2c8cbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,26 @@
// check-pass
trait Factory {
type Product;
}
impl Factory for () {
type Product = ();
}
trait ProductConsumer<P> {
fn consume(self, product: P);
}
impl<P> ProductConsumer<P> for () {
fn consume(self, _: P) {}
}
fn make_product_consumer<F: Factory>(_: F) -> impl ProductConsumer<F::Product> {
()
}
fn main() {
let consumer = make_product_consumer(());
consumer.consume(());
}