summaryrefslogtreecommitdiffstats
path: root/src/test/ui/impl-trait/needs_least_region_or_bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/impl-trait/needs_least_region_or_bound.rs')
-rw-r--r--src/test/ui/impl-trait/needs_least_region_or_bound.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/needs_least_region_or_bound.rs b/src/test/ui/impl-trait/needs_least_region_or_bound.rs
new file mode 100644
index 000000000..c4bcfe5b2
--- /dev/null
+++ b/src/test/ui/impl-trait/needs_least_region_or_bound.rs
@@ -0,0 +1,21 @@
+// check-pass
+
+trait MultiRegionTrait<'a, 'b> {}
+impl<'a, 'b> MultiRegionTrait<'a, 'b> for (&'a u32, &'b u32) {}
+
+fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
+ // Here we have a constraint that:
+ //
+ // (x, y) has type (&'0 u32, &'1 u32)
+ //
+ // where
+ //
+ // 'a: '0
+ //
+ // then we require that `('0 u32, &'1 u32): MultiRegionTrait<'a,
+ // 'b>`, which winds up imposing a requirement that `'0 = 'a` and
+ // `'1 = 'b`.
+ (x, y)
+}
+
+fn main() {}