mirror of https://github.com/rust-lang/rust.git
Fix corrected example in E0759.md
This commit is contained in:
parent
f57d5ba3c9
commit
31eee595cf
|
@ -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)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue