diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-02-17 13:46:59 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-17 13:46:59 +0900 |
| commit | cc497c4c84be72d0c4a06ef1b202faf266b0843a (patch) | |
| tree | 5dfbd881c26c3225cc85f403f2d2990957be3322 | |
| parent | 3e7addccc6acb1fb8393233c895904c43fc429ee (diff) | |
| parent | cadf9efad123a62472cad45f22569747cc599256 (diff) | |
| download | rust-cc497c4c84be72d0c4a06ef1b202faf266b0843a.tar.gz rust-cc497c4c84be72d0c4a06ef1b202faf266b0843a.zip | |
Rollup merge of #69188 - GuillaumeGomez:clean-up-e0309, r=Dylan-DPC
Clean up E0309 explanation r? @Dylan-DPC
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0309.md | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/librustc_error_codes/error_codes/E0309.md b/src/librustc_error_codes/error_codes/E0309.md index 73ce7407476..e719ee590ab 100644 --- a/src/librustc_error_codes/error_codes/E0309.md +++ b/src/librustc_error_codes/error_codes/E0309.md @@ -1,9 +1,7 @@ -The type definition contains some field whose type -requires an outlives annotation. Outlives annotations -(e.g., `T: 'a`) are used to guarantee that all the data in T is valid -for at least the lifetime `'a`. This scenario most commonly -arises when the type contains an associated type reference -like `<T as SomeTrait<'a>>::Output`, as shown in this example: +A parameter type is missing an explicit lifetime bound and may not live long +enough. + +Erroneous code example: ```compile_fail,E0309 // This won't compile because the applicable impl of @@ -25,9 +23,15 @@ where } ``` -Here, the where clause `T: 'a` that appears on the impl is not known to be -satisfied on the struct. To make this example compile, you have to add -a where-clause like `T: 'a` to the struct definition: +The type definition contains some field whose type requires an outlives +annotation. Outlives annotations (e.g., `T: 'a`) are used to guarantee that all +the data in T is valid for at least the lifetime `'a`. This scenario most +commonly arises when the type contains an associated type reference like +`<T as SomeTrait<'a>>::Output`, as shown in the previous code. + +There, the where clause `T: 'a` that appears on the impl is not known to be +satisfied on the struct. To make this example compile, you have to add a +where-clause like `T: 'a` to the struct definition: ``` struct Foo<'a, T> |
