Fix corrected example in E0759.md

This commit is contained in:
Fabian Wolff 2021-06-06 22:54:00 +02:00
parent f57d5ba3c9
commit 31eee595cf
1 changed files with 3 additions and 3 deletions

View File

@ -16,13 +16,13 @@ fn bar(x: &i32) -> Box<dyn Debug> { // error!
Add `'static` requirement to fix them: Add `'static` requirement to fix them:
```compile_fail,E0759 ```
# use std::fmt::Debug; # use std::fmt::Debug;
fn foo(x: &i32) -> impl Debug + 'static { // ok! fn foo(x: &'static i32) -> impl Debug + 'static { // ok!
x x
} }
fn bar(x: &i32) -> Box<dyn Debug + 'static> { // ok! fn bar(x: &'static i32) -> Box<dyn Debug + 'static> { // ok!
Box::new(x) Box::new(x)
} }
``` ```