rust/tests/ui/inference/issue-70703.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
410 B
Rust
Raw Normal View History

2021-07-01 18:31:51 -05:00
// 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(());
}