]> git.proxmox.com Git - rustc.git/blob - src/test/ui/self/elision/lt-ref-self-async.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / self / elision / lt-ref-self-async.rs
1 // edition:2018
2
3 #![allow(non_snake_case)]
4
5 use std::pin::Pin;
6
7 struct Struct<'a> { data: &'a u32 }
8
9 impl<'a> Struct<'a> {
10 // Test using `&self` sugar:
11
12 async fn ref_self(&self, f: &u32) -> &u32 {
13 f
14 //~^ ERROR lifetime may not live long enough
15 }
16
17 // Test using `&Self` explicitly:
18
19 async fn ref_Self(self: &Self, f: &u32) -> &u32 {
20 f
21 //~^ ERROR lifetime may not live long enough
22 }
23
24 async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
25 f
26 //~^ ERROR lifetime may not live long enough
27 }
28
29 async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
30 f
31 //~^ ERROR lifetime may not live long enough
32 }
33
34 async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
35 f
36 //~^ ERROR lifetime may not live long enough
37 }
38
39 async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
40 f
41 //~^ ERROR lifetime may not live long enough
42 }
43 }
44
45 fn main() { }