File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1- The type definition contains some field whose type
2- requires an outlives annotation. Outlives annotations
3- (e.g., ` T: 'a ` ) are used to guarantee that all the data in T is valid
4- for at least the lifetime ` 'a ` . This scenario most commonly
5- arises when the type contains an associated type reference
6- like ` <T as SomeTrait<'a>>::Output ` , as shown in this example:
1+ A parameter type is missing an explicit lifetime bound and may not live long
2+ enough.
3+
4+ Erroneous code example:
75
86``` compile_fail,E0309
97// This won't compile because the applicable impl of
2523}
2624```
2725
28- Here, the where clause ` T: 'a ` that appears on the impl is not known to be
29- satisfied on the struct. To make this example compile, you have to add
30- a where-clause like ` T: 'a ` to the struct definition:
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.
31+
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:
3135
3236```
3337struct Foo<'a, T>
You can’t perform that action at this time.
0 commit comments