File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 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:
55
66``` compile_fail,E0310
77// This won't compile because T is not constrained to the static lifetime
@@ -11,6 +11,11 @@ struct Foo<T> {
1111}
1212```
1313
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+
1419This will compile, because it has the constraint on the type parameter:
1520
1621```
You can’t perform that action at this time.
0 commit comments