diff --git a/src/test/ui/inference/issue-70703.rs b/src/test/ui/inference/issue-70703.rs new file mode 100644 index 0000000000000..d90498e96ea77 --- /dev/null +++ b/src/test/ui/inference/issue-70703.rs @@ -0,0 +1,26 @@ +// check-pass + +trait Factory { + type Product; +} + +impl Factory for () { + type Product = (); +} + +trait ProductConsumer

{ + fn consume(self, product: P); +} + +impl

ProductConsumer

for () { + fn consume(self, _: P) {} +} + +fn make_product_consumer(_: F) -> impl ProductConsumer { + () +} + +fn main() { + let consumer = make_product_consumer(()); + consumer.consume(()); +}