Fix corrected example in E0759.md
This commit is contained in:
parent
f57d5ba3c9
commit
31eee595cf
1 changed files with 3 additions and 3 deletions
|
@ -16,13 +16,13 @@ fn bar(x: &i32) -> Box<dyn Debug> { // error!
|
|||
|
||||
Add `'static` requirement to fix them:
|
||||
|
||||
```compile_fail,E0759
|
||||
```
|
||||
# use std::fmt::Debug;
|
||||
fn foo(x: &i32) -> impl Debug + 'static { // ok!
|
||||
fn foo(x: &'static i32) -> impl Debug + 'static { // ok!
|
||||
x
|
||||
}
|
||||
|
||||
fn bar(x: &i32) -> Box<dyn Debug + 'static> { // ok!
|
||||
fn bar(x: &'static i32) -> Box<dyn Debug + 'static> { // ok!
|
||||
Box::new(x)
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue