]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs
Rollup merge of #106661 - mjguzik:linux_statx, r=Mark-Simulacrum
[rust.git] / tests / ui / impl-trait / multiple-lifetimes / ordinary-bounds-pick-original.rs
1 // edition:2018
2 // build-pass (FIXME(62277): could be check-pass?)
3
4 trait Trait<'a, 'b> {}
5 impl<T> Trait<'_, '_> for T {}
6
7 // Here we wind up selecting `'a` and `'b` in the hidden type because
8 // those are the types that appear in the original values.
9
10 fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
11     // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
12     //
13     // ```
14     // 'a: '0
15     // 'b: '1
16     // '0 in ['a, 'b]
17     // '1 in ['a, 'b]
18     // ```
19     //
20     // We use the fact that `'a: 0'` must hold (combined with the in
21     // constraint) to determine that `'0 = 'a` must be the answer.
22     (a, b)
23 }
24
25 fn main() {}