]>
Commit | Line | Data |
---|---|---|
e1599b0c XL |
1 | // edition:2018 |
2 | ||
3 | // This test checks that `Self` is prohibited as a return type. See #61949 for context. | |
4 | ||
5 | pub struct Foo<'a> { | |
6 | pub bar: &'a i32, | |
7 | } | |
8 | ||
9 | impl<'a> Foo<'a> { | |
10 | pub async fn new(_bar: &'a i32) -> Self { | |
11 | //~^ ERROR `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope | |
12 | Foo { | |
13 | bar: &22 | |
14 | } | |
15 | } | |
16 | } | |
17 | ||
18 | async fn foo() { | |
19 | let x = { | |
20 | let bar = 22; | |
21 | Foo::new(&bar).await | |
22 | }; | |
23 | drop(x); | |
24 | } | |
25 | ||
26 | fn main() { } |