2019-06-01 06:01:49 -05:00
|
|
|
// edition:2018
|
2019-07-04 05:28:20 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2019-06-10 16:22:02 -05:00
|
|
|
// revisions: migrate mir
|
|
|
|
//[mir]compile-flags: -Z borrowck=mir
|
2019-06-01 06:01:49 -05:00
|
|
|
|
2019-06-20 09:44:20 -05:00
|
|
|
#![feature(member_constraints)]
|
|
|
|
|
2019-06-01 06:01:49 -05:00
|
|
|
trait Trait<'a, 'b> { }
|
|
|
|
impl<T> Trait<'_, '_> for T { }
|
|
|
|
|
|
|
|
// Here we wind up selecting `'a` and `'b` in the hidden type because
|
2019-06-24 14:55:39 -05:00
|
|
|
// those are the types that appear in the original values.
|
2019-06-01 06:01:49 -05:00
|
|
|
|
|
|
|
fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
|
|
|
|
// In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
|
|
|
|
//
|
|
|
|
// ```
|
|
|
|
// 'a: '0
|
|
|
|
// 'b: '1
|
|
|
|
// '0 in ['a, 'b]
|
|
|
|
// '1 in ['a, 'b]
|
|
|
|
// ```
|
|
|
|
//
|
|
|
|
// We use the fact that `'a: 0'` must hold (combined with the in
|
|
|
|
// constraint) to determine that `'0 = 'a` must be the answer.
|
|
|
|
(a, b)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|