]> git.proxmox.com Git - rustc.git/blame - src/test/ui/async-await/issue-61949-self-return-type.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / ui / async-await / issue-61949-self-return-type.rs
CommitLineData
e1599b0c
XL
1// edition:2018
2
3// This test checks that `Self` is prohibited as a return type. See #61949 for context.
4
5pub struct Foo<'a> {
6 pub bar: &'a i32,
7}
8
9impl<'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
18async fn foo() {
19 let x = {
20 let bar = 22;
21 Foo::new(&bar).await
22 };
23 drop(x);
24}
25
26fn main() { }