Clean up E0759 explanation
This commit is contained in:
parent
441fd22557
commit
46f2b410e0
1 changed files with 4 additions and 10 deletions
|
|
@ -5,14 +5,11 @@ Erroneous code examples:
|
|||
```compile_fail,E0759
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn foo(x: &i32) -> impl Debug {
|
||||
fn foo(x: &i32) -> impl Debug { // error!
|
||||
x
|
||||
}
|
||||
```
|
||||
|
||||
```compile_fail,E0759
|
||||
# use std::fmt::Debug;
|
||||
fn bar(x: &i32) -> Box<dyn Debug> {
|
||||
fn bar(x: &i32) -> Box<dyn Debug> { // error!
|
||||
Box::new(x)
|
||||
}
|
||||
```
|
||||
|
|
@ -21,14 +18,11 @@ These examples have the same semantics as the following:
|
|||
|
||||
```compile_fail,E0759
|
||||
# use std::fmt::Debug;
|
||||
fn foo(x: &i32) -> impl Debug + 'static {
|
||||
fn foo(x: &i32) -> impl Debug + 'static { // ok!
|
||||
x
|
||||
}
|
||||
```
|
||||
|
||||
```compile_fail,E0759
|
||||
# use std::fmt::Debug;
|
||||
fn bar(x: &i32) -> Box<dyn Debug + 'static> {
|
||||
fn bar(x: &i32) -> Box<dyn Debug + 'static> { // ok!
|
||||
Box::new(x)
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue