diff options
| author | Ralf Jung <post@ralfj.de> | 2020-05-14 10:22:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-14 10:22:55 +0200 |
| commit | 0b8b38c4c276d08b0061dfd6cbc1b1a8ca31dbd0 (patch) | |
| tree | f1ee81f875adad8646f9bae7d7dec15dad84f0ea /src/librustc_error_codes/error_codes | |
| parent | 577da45097e439c1aefd853b9ff41f305449b848 (diff) | |
| parent | 61fbe57f4afd8f5b1a348b644d00c912d4b2e9fb (diff) | |
| download | rust-0b8b38c4c276d08b0061dfd6cbc1b1a8ca31dbd0.tar.gz rust-0b8b38c4c276d08b0061dfd6cbc1b1a8ca31dbd0.zip | |
Rollup merge of #72137 - GuillaumeGomez:cleanup-e0581, r=Dylan-DPC
Clean up E0581 explanation r? @Dylan-DPC
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0581.md | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc_error_codes/error_codes/E0581.md b/src/librustc_error_codes/error_codes/E0581.md index 947ec255a9d..89f6e3269ec 100644 --- a/src/librustc_error_codes/error_codes/E0581.md +++ b/src/librustc_error_codes/error_codes/E0581.md @@ -1,4 +1,4 @@ -In a `fn` type, a lifetime appears only in the return type, +In a `fn` type, a lifetime appears only in the return type and not in the arguments types. Erroneous code example: @@ -10,8 +10,11 @@ fn main() { } ``` -To fix this issue, either use the lifetime in the arguments, or use -`'static`. Example: +The problem here is that the lifetime isn't contrained by any of the arguments, +making it impossible to determine how long it's supposed to live. + +To fix this issue, either use the lifetime in the arguments, or use the +`'static` lifetime. Example: ``` fn main() { |
