]> git.proxmox.com Git - rustc.git/blob - src/test/ui/self/elision/ref-struct.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / self / elision / ref-struct.rs
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
10 fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
11 f
12 //~^ ERROR lifetime may not live long enough
13 }
14
15 fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
16 f
17 //~^ ERROR lifetime may not live long enough
18 }
19
20 fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
21 f
22 //~^ ERROR lifetime may not live long enough
23 }
24
25 fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
26 f
27 //~^ ERROR lifetime may not live long enough
28 }
29
30 fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
31 f
32 //~^ ERROR lifetime may not live long enough
33 }
34 }
35
36 fn main() { }