]> git.proxmox.com Git - rustc.git/blame - src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / ui / impl-trait / multiple-lifetimes / ordinary-bounds-pick-original-existential.rs
CommitLineData
dc9dc135
XL
1// edition:2018
2// compile-pass
3// revisions: migrate mir
4//[mir]compile-flags: -Z borrowck=mir
5
6#![feature(member_constraints)]
7#![feature(existential_type)]
8
9trait Trait<'a, 'b> { }
10impl<T> Trait<'_, '_> for T { }
11
12// Here we wind up selecting `'a` and `'b` in the hidden type because
13// those are the types that appear in the original values.
14
15existential type Foo<'a, 'b>: Trait<'a, 'b>;
16
17fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> Foo<'a, 'b> {
18 // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
19 //
20 // ```
21 // 'a: '0
22 // 'b: '1
23 // '0 in ['a, 'b]
24 // '1 in ['a, 'b]
25 // ```
26 //
27 // We use the fact that `'a: 0'` must hold (combined with the in
28 // constraint) to determine that `'0 = 'a` must be the answer.
29 (a, b)
30}
31
32fn main() { }