Rollup merge of #86077 - FabianWolff:issue-86061, r=GuillaumeGomez
Fix corrected example in E0759.md This pull request fixes #86061, which was probably caused by a copy-paste error, where the supposedly corrected code example was also marked with `compile_fail`. Thus, the fact that the "correct" example actually _isn't_ correct was not caught by the doc-tests. This pull request removes the incorrect `compile_fail` annotation and fixes the example. r? ``@GuillaumeGomez``
This commit is contained in:
commit
487200b438
@ -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…
x
Reference in New Issue
Block a user