1 #![allow(non_snake_case)]
2
3 use std::pin::Pin;
4
5 struct Struct { }
6
7 impl Struct {
8 // Test using `&Struct` explicitly:
9
ref_Struct(self: &Struct, f: &u32) -> &u3210 fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
11 f
12 //~^ ERROR lifetime may not live long enough
13 }
14
box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u3215 fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
16 f
17 //~^ ERROR lifetime may not live long enough
18 }
19
pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u3220 fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
21 f
22 //~^ ERROR lifetime may not live long enough
23 }
24
box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u3225 fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
26 f
27 //~^ ERROR lifetime may not live long enough
28 }
29
box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u3230 fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
31 f
32 //~^ ERROR lifetime may not live long enough
33 }
34 }
35
main()36 fn main() { }
37