Skip to content

Commit cc497c4

Browse files
authored
Rollup merge of #69188 - GuillaumeGomez:clean-up-e0309, r=Dylan-DPC
Clean up E0309 explanation r? @Dylan-DPC
2 parents 3e7addc + cadf9ef commit cc497c4

File tree

1 file changed

+13
-9
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+13
-9
lines changed

src/librustc_error_codes/error_codes/E0309.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
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
@@ -25,9 +23,15 @@ where
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
```
3337
struct Foo<'a, T>

0 commit comments

Comments
 (0)