Skip to content

Commit 73283f1

Browse files
Clean up E0310 explanation
1 parent dbef353 commit 73283f1

File tree

1 file changed

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

1 file changed

+9
-4
lines changed

src/librustc_error_codes/error_codes/E0310.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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+
1419
This will compile, because it has the constraint on the type parameter:
1520

1621
```

0 commit comments

Comments
 (0)