From 46f2b410e0871587dde5e4375d23ebe332ec1176 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 19 Aug 2020 14:22:52 +0200 Subject: [PATCH 1/2] Clean up E0759 explanation --- src/librustc_error_codes/error_codes/E0759.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0759.md b/src/librustc_error_codes/error_codes/E0759.md index a74759bdf634b..2daaeba82f067 100644 --- a/src/librustc_error_codes/error_codes/E0759.md +++ b/src/librustc_error_codes/error_codes/E0759.md @@ -5,14 +5,11 @@ 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) } ``` @@ -21,14 +18,11 @@ These examples have the same semantics as the following: ```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) } ``` From 7f55c834873cd9363bbdfa199f3d0dbadce99592 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 20 Aug 2020 15:25:35 +0200 Subject: [PATCH 2/2] Apply review comments --- src/librustc_error_codes/error_codes/E0759.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0759.md b/src/librustc_error_codes/error_codes/E0759.md index 2daaeba82f067..6d525310f75c3 100644 --- a/src/librustc_error_codes/error_codes/E0759.md +++ b/src/librustc_error_codes/error_codes/E0759.md @@ -1,4 +1,4 @@ -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: @@ -14,7 +14,7 @@ fn bar(x: &i32) -> Box { // error! } ``` -These examples have the same semantics as the following: +Add `'static` requirement to fix them: ```compile_fail,E0759 # use std::fmt::Debug;