]> git.proxmox.com Git - rustc.git/blob - src/test/ui/impl-trait/needs_least_region_or_bound.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / impl-trait / needs_least_region_or_bound.rs
1 // check-pass
2
3 trait MultiRegionTrait<'a, 'b> {}
4 impl<'a, 'b> MultiRegionTrait<'a, 'b> for (&'a u32, &'b u32) {}
5
6 fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
7 // Here we have a constraint that:
8 //
9 // (x, y) has type (&'0 u32, &'1 u32)
10 //
11 // where
12 //
13 // 'a: '0
14 //
15 // then we require that `('0 u32, &'1 u32): MultiRegionTrait<'a,
16 // 'b>`, which winds up imposing a requirement that `'0 = 'a` and
17 // `'1 = 'b`.
18 (x, y)
19 }
20
21 fn main() {}