File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,7 @@ E0750: include_str!("./error_codes/E0750.md"),
435
435
E0751 : include_str!( "./error_codes/E0751.md" ) ,
436
436
E0752 : include_str!( "./error_codes/E0752.md" ) ,
437
437
E0753 : include_str!( "./error_codes/E0753.md" ) ,
438
+ E0754 : include_str!( "./error_codes/E0754.md" ) ,
438
439
;
439
440
// E0006, // merged with E0005
440
441
// E0008, // cannot bind by-move into a pattern guard
Original file line number Diff line number Diff line change
1
+ ` async fn ` /` impl trait ` return type cannot contain a projection or ` Self ` that references lifetimes from a parent scope.
2
+
3
+ Erroneous code example:
4
+
5
+ ``` compile_fail,E0754,edition2018
6
+ struct S<'a>(&'a i32);
7
+
8
+ impl<'a> S<'a> {
9
+ async fn new(i: &'a i32) -> Self {
10
+ S(&22)
11
+ }
12
+ }
13
+ ```
14
+
15
+ To fix this error we need to spell out ` Self ` to ` S<'a> ` :
16
+
17
+ ``` edition2018
18
+ struct S<'a>(&'a i32);
19
+
20
+ impl<'a> S<'a> {
21
+ async fn new(i: &'a i32) -> S<'a> {
22
+ S(&22)
23
+ }
24
+ }
25
+ ```
26
+
27
+ This will be allowed at some point in the future, but the implementation is not yet complete. See the [ issue-61949] for this limitation.
28
+
29
+ [ issue-61949 ] : https://github.com/rust-lang/rust/issues/61949
You can’t perform that action at this time.
0 commit comments