Clean up E0759 explanation

This commit is contained in:
Guillaume Gomez 2020-08-19 14:22:52 +02:00
parent 441fd22557
commit 46f2b410e0

View file

@ -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)
}
```