diff options
| author | Josh Stone <cuviper@gmail.com> | 2020-08-20 10:07:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-20 10:07:22 -0700 |
| commit | ba104d291a40f5242c56b672763a1941ac23b52d (patch) | |
| tree | 61ae19f5def423442060c3b307bccbf81a535b86 /src/librustc_error_codes/error_codes | |
| parent | f29f21285efd38574e5a36b24a36b21f233ee336 (diff) | |
| parent | 7f55c834873cd9363bbdfa199f3d0dbadce99592 (diff) | |
| download | rust-ba104d291a40f5242c56b672763a1941ac23b52d.tar.gz rust-ba104d291a40f5242c56b672763a1941ac23b52d.zip | |
Rollup merge of #75702 - GuillaumeGomez:cleanup-e0759, r=pickfire
Clean up E0759 explanation r? @Dylan-DPC cc @pickfire
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0759.md | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/librustc_error_codes/error_codes/E0759.md b/src/librustc_error_codes/error_codes/E0759.md index a74759bdf63..6d525310f75 100644 --- a/src/librustc_error_codes/error_codes/E0759.md +++ b/src/librustc_error_codes/error_codes/E0759.md @@ -1,34 +1,28 @@ -A `'static` requirement in a return type involving a trait is not fulfilled. +Return type involving a trait did not require `'static` lifetime. Erroneous code examples: ```compile_fail,E0759 use std::fmt::Debug; -fn foo(x: &i32) -> impl Debug { +fn foo(x: &i32) -> impl Debug { // error! x } -``` -```compile_fail,E0759 -# use std::fmt::Debug; -fn bar(x: &i32) -> Box<dyn Debug> { +fn bar(x: &i32) -> Box<dyn Debug> { // error! Box::new(x) } ``` -These examples have the same semantics as the following: +Add `'static` requirement to fix them: ```compile_fail,E0759 # use std::fmt::Debug; -fn foo(x: &i32) -> impl Debug + 'static { +fn foo(x: &i32) -> impl Debug + 'static { // ok! x } -``` -```compile_fail,E0759 -# use std::fmt::Debug; -fn bar(x: &i32) -> Box<dyn Debug + 'static> { +fn bar(x: &i32) -> Box<dyn Debug + 'static> { // ok! Box::new(x) } ``` |
