Skip to content

Commit

Permalink
Rollup merge of #86077 - FabianWolff:issue-86061, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
GuillaumeGomez authored Jun 6, 2021
2 parents 029df23 + 31eee59 commit b3e1061
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_error_codes/src/error_codes/E0759.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
```
Expand Down

0 comments on commit b3e1061

Please sign in to comment.