blob: bb201e5c0754c8d0e23bcf4843a6cb2cf67830cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// Test that we are NOT able to establish that `<T as
// MyTrait<'a>>::Output: 'a` outlives `'a` here -- we have only one
// recourse, which is to prove that `T: 'a` and `'a: 'a`, but we don't
// know that `T: 'a`.
trait MyTrait<'a> {
type Output;
}
fn foo<'a, T>() -> &'a ()
where
T: MyTrait<'a>,
{
bar::<T::Output>() //~ ERROR the parameter type `T` may not live long enough
}
fn bar<'a, T>() -> &'a ()
where
T: 'a,
{
&()
}
fn main() {}
|