mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
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:
|
||||
|
||||
```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…
Reference in New Issue
Block a user