Skip to content

Commit 46f2b41

Browse files
Clean up E0759 explanation
1 parent 441fd22 commit 46f2b41

File tree

1 file changed

+4
-10
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+4
-10
lines changed

src/librustc_error_codes/error_codes/E0759.md

+4-10
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ Erroneous code examples:
55
```compile_fail,E0759
66
use std::fmt::Debug;
77
8-
fn foo(x: &i32) -> impl Debug {
8+
fn foo(x: &i32) -> impl Debug { // error!
99
x
1010
}
11-
```
1211
13-
```compile_fail,E0759
14-
# use std::fmt::Debug;
15-
fn bar(x: &i32) -> Box<dyn Debug> {
12+
fn bar(x: &i32) -> Box<dyn Debug> { // error!
1613
Box::new(x)
1714
}
1815
```
@@ -21,14 +18,11 @@ These examples have the same semantics as the following:
2118

2219
```compile_fail,E0759
2320
# use std::fmt::Debug;
24-
fn foo(x: &i32) -> impl Debug + 'static {
21+
fn foo(x: &i32) -> impl Debug + 'static { // ok!
2522
x
2623
}
27-
```
2824
29-
```compile_fail,E0759
30-
# use std::fmt::Debug;
31-
fn bar(x: &i32) -> Box<dyn Debug + 'static> {
25+
fn bar(x: &i32) -> Box<dyn Debug + 'static> { // ok!
3226
Box::new(x)
3327
}
3428
```

0 commit comments

Comments
 (0)