]> git.proxmox.com Git - rustc.git/blame - src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-type-alias-impl-trait.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / impl-trait / multiple-lifetimes / ordinary-bounds-pick-original-type-alias-impl-trait.rs
CommitLineData
dc9dc135 1// edition:2018
416331ca 2// check-pass
dc9dc135
XL
3// revisions: migrate mir
4//[mir]compile-flags: -Z borrowck=mir
5
6#![feature(member_constraints)]
6a06907d 7#![feature(min_type_alias_impl_trait)]
dc9dc135
XL
8trait Trait<'a, 'b> { }
9impl<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
416331ca 14type Foo<'a, 'b> = impl Trait<'a, 'b>;
dc9dc135
XL
15
16fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> Foo<'a, 'b> {
17 // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
18 //
19 // ```
20 // 'a: '0
21 // 'b: '1
22 // '0 in ['a, 'b]
23 // '1 in ['a, 'b]
24 // ```
25 //
26 // We use the fact that `'a: 0'` must hold (combined with the in
27 // constraint) to determine that `'0 = 'a` must be the answer.
28 (a, b)
29}
30
31fn main() { }