diff --git a/src/librustc_error_codes/error_codes/E0759.md b/src/librustc_error_codes/error_codes/E0759.md index a74759bdf634b0c5deb874b8269468d5d2981507..6d525310f75c3320cd0cea6cc8140d65b8219f67 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 { +fn bar(x: &i32) -> Box { // 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 { +fn bar(x: &i32) -> Box { // ok! Box::new(x) } ```