2018-09-21 18:26:24 -05:00
|
|
|
// Test that when we infer the lifetime to a subset of the fn body, it
|
|
|
|
// works out.
|
2018-09-24 14:36:50 -05:00
|
|
|
//
|
2020-01-22 18:00:00 -06:00
|
|
|
// check-pass
|
2018-09-21 18:26:24 -05:00
|
|
|
|
|
|
|
trait MyTrait<'a> {
|
|
|
|
type Output;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo1<T>()
|
|
|
|
where
|
|
|
|
for<'x> T: MyTrait<'x>,
|
|
|
|
{
|
|
|
|
// Here the region `'c` in `<T as MyTrait<'c>>::Output` will be
|
|
|
|
// inferred to a subset of the fn body.
|
|
|
|
let x = bar::<T::Output>();
|
|
|
|
drop(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar<'a, T>() -> &'a ()
|
|
|
|
where
|
|
|
|
T: 'a,
|
|
|
|
{
|
|
|
|
&()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|