File tree 1 file changed +6
-12
lines changed
src/librustc_error_codes/error_codes
1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1
- A ` 'static ` requirement in a return type involving a trait is not fulfilled .
1
+ Return type involving a trait did not require ` 'static ` lifetime .
2
2
3
3
Erroneous code examples:
4
4
5
5
``` compile_fail,E0759
6
6
use std::fmt::Debug;
7
7
8
- fn foo(x: &i32) -> impl Debug {
8
+ fn foo(x: &i32) -> impl Debug { // error!
9
9
x
10
10
}
11
- ```
12
11
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!
16
13
Box::new(x)
17
14
}
18
15
```
19
16
20
- These examples have the same semantics as the following :
17
+ Add ` 'static ` requirement to fix them :
21
18
22
19
``` compile_fail,E0759
23
20
# use std::fmt::Debug;
24
- fn foo(x: &i32) -> impl Debug + 'static {
21
+ fn foo(x: &i32) -> impl Debug + 'static { // ok!
25
22
x
26
23
}
27
- ```
28
24
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!
32
26
Box::new(x)
33
27
}
34
28
```
You can’t perform that action at this time.
0 commit comments