From 61fbe57f4afd8f5b1a348b644d00c912d4b2e9fb Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 12 May 2020 13:36:57 +0200 Subject: Clean up E0581 explanation --- src/librustc_error_codes/error_codes/E0581.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/librustc_error_codes/error_codes') 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() { -- cgit 1.4.1-3-g733a5 From bb2ff593a63dc5500b0dd8d83cfa9bdca5768b79 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 13 May 2020 13:40:55 +0200 Subject: Clean up E0582 explanation --- src/librustc_error_codes/error_codes/E0582.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0582.md b/src/librustc_error_codes/error_codes/E0582.md index c0cf44852c4..e50cc60ea33 100644 --- a/src/librustc_error_codes/error_codes/E0582.md +++ b/src/librustc_error_codes/error_codes/E0582.md @@ -1,5 +1,5 @@ -A lifetime appears only in an associated-type binding, -and not in the input types to the trait. +A lifetime is only present in an associated-type binding, and not in the input +types to the trait. Erroneous code example: -- cgit 1.4.1-3-g733a5