]>
Commit | Line | Data |
---|---|---|
dc9dc135 | 1 | // edition:2018 |
416331ca | 2 | // build-pass (FIXME(62277): could be check-pass?) |
dc9dc135 XL |
3 | // revisions: migrate mir |
4 | //[mir]compile-flags: -Z borrowck=mir | |
5 | ||
6 | #![feature(member_constraints)] | |
7 | ||
8 | trait Trait<'a, 'b> { } | |
9 | impl<T> Trait<'_, '_> for T { } | |
10 | ||
11 | // Here we wind up selecting `'a` and `'b` in the hidden type because | |
12 | // those are the types that appear in the original values. | |
13 | ||
14 | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { | |
15 | // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like | |
16 | // | |
17 | // ``` | |
18 | // 'a: '0 | |
19 | // 'b: '1 | |
20 | // '0 in ['a, 'b] | |
21 | // '1 in ['a, 'b] | |
22 | // ``` | |
23 | // | |
24 | // We use the fact that `'a: 0'` must hold (combined with the in | |
25 | // constraint) to determine that `'0 = 'a` must be the answer. | |
26 | (a, b) | |
27 | } | |
28 | ||
29 | fn main() { } |