]>
Commit | Line | Data |
---|---|---|
e1599b0c XL |
1 | // edition:2018 |
2 | ||
e1599b0c XL |
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 { | |
04454e1e | 13 | f |
923072b8 | 14 | //~^ ERROR lifetime may not live long enough |
e1599b0c XL |
15 | } |
16 | ||
17 | // Test using `&Self` explicitly: | |
18 | ||
19 | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | |
04454e1e | 20 | f |
923072b8 | 21 | //~^ ERROR lifetime may not live long enough |
e1599b0c XL |
22 | } |
23 | ||
24 | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | |
04454e1e | 25 | f |
923072b8 | 26 | //~^ ERROR lifetime may not live long enough |
e1599b0c XL |
27 | } |
28 | ||
29 | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | |
04454e1e | 30 | f |
923072b8 | 31 | //~^ ERROR lifetime may not live long enough |
e1599b0c XL |
32 | } |
33 | ||
34 | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | |
04454e1e | 35 | f |
923072b8 | 36 | //~^ ERROR lifetime may not live long enough |
e1599b0c XL |
37 | } |
38 | ||
39 | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | |
04454e1e | 40 | f |
923072b8 | 41 | //~^ ERROR lifetime may not live long enough |
e1599b0c XL |
42 | } |
43 | } | |
44 | ||
45 | fn main() { } |