1 A parameter type is missing an explicit lifetime bound and may not live long
4 Erroneous code example:
7 // This won't compile because the applicable impl of
8 // `SomeTrait` (below) requires that `T: 'a`, but the struct does
9 // not have a matching where-clause.
11 foo: <T as SomeTrait<'a>>::Output,
18 impl<'a, T> SomeTrait<'a> for T
26 The type definition contains some field whose type requires an outlives
27 annotation. Outlives annotations (e.g., `T: 'a`) are used to guarantee that all
28 the data in T is valid for at least the lifetime `'a`. This scenario most
29 commonly arises when the type contains an associated type reference like
30 `<T as SomeTrait<'a>>::Output`, as shown in the previous code.
32 There, the where clause `T: 'a` that appears on the impl is not known to be
33 satisfied on the struct. To make this example compile, you have to add a
34 where-clause like `T: 'a` to the struct definition:
41 foo: <T as SomeTrait<'a>>::Output
48 impl<'a, T> SomeTrait<'a> for T