File tree 1 file changed +9
-4
lines changed
src/librustc_error_codes/error_codes
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
- Types in type definitions have lifetimes associated with them that represent
2
- how long the data stored within them is guaranteed to be live. This lifetime
3
- must be as long as the data needs to be alive, and missing the constraint that
4
- denotes this will cause this error.
1
+ A parameter type is missing a lifetime constraint or has a lifetime that
2
+ does not live long enough.
3
+
4
+ Erroneous code example:
5
5
6
6
``` compile_fail,E0310
7
7
// This won't compile because T is not constrained to the static lifetime
@@ -11,6 +11,11 @@ struct Foo<T> {
11
11
}
12
12
```
13
13
14
+ Type parameters in type definitions have lifetimes associated with them that
15
+ represent how long the data stored within them is guaranteed to live. This
16
+ lifetime must be as long as the data needs to be alive, and missing the
17
+ constraint that denotes this will cause this error.
18
+
14
19
This will compile, because it has the constraint on the type parameter:
15
20
16
21
```
You can’t perform that action at this time.
0 commit comments