]> git.proxmox.com Git - rustc.git/blame - src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / impl-trait / multiple-lifetimes / ordinary-bounds-pick-original.rs
CommitLineData
dc9dc135 1// edition:2018
416331ca 2// build-pass (FIXME(62277): could be check-pass?)
dc9dc135 3
17df50a5
XL
4trait Trait<'a, 'b> {}
5impl<T> Trait<'_, '_> for T {}
dc9dc135
XL
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
10fn 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
17df50a5 25fn main() {}