Update error code documentation.

This commit is contained in:
Camille GILLOT 2021-12-27 18:14:27 +01:00
parent 289216f281
commit c6a3f5d606

View File

@ -1,4 +1,4 @@
`async fn`/`impl trait` return type cannot contain a projection `impl trait` return type cannot contain a projection
or `Self` that references lifetimes from a parent scope. or `Self` that references lifetimes from a parent scope.
Erroneous code example: Erroneous code example:
@ -7,7 +7,7 @@ Erroneous code example:
struct S<'a>(&'a i32); struct S<'a>(&'a i32);
impl<'a> S<'a> { impl<'a> S<'a> {
async fn new(i: &'a i32) -> Self { fn new(i: &'a i32) -> impl Into<Self> {
S(&22) S(&22)
} }
} }
@ -19,7 +19,7 @@ To fix this error we need to spell out `Self` to `S<'a>`:
struct S<'a>(&'a i32); struct S<'a>(&'a i32);
impl<'a> S<'a> { impl<'a> S<'a> {
async fn new(i: &'a i32) -> S<'a> { fn new(i: &'a i32) -> impl Into<S<'a>> {
S(&22) S(&22)
} }
} }