]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/elision/lt-ref-self.rs
Rollup merge of #63055 - Mark-Simulacrum:save-analysis-clean-2, r=Xanewok
[rust.git] / src / test / ui / self / elision / lt-ref-self.rs
1 #![feature(arbitrary_self_types)]
2 #![allow(non_snake_case)]
3
4 use std::pin::Pin;
5
6 struct Struct<'a> { data: &'a u32 }
7
8 impl<'a> Struct<'a> {
9     // Test using `&self` sugar:
10
11     fn ref_self(&self, f: &u32) -> &u32 {
12         f //~ ERROR lifetime mismatch
13     }
14
15     // Test using `&Self` explicitly:
16
17     fn ref_Self(self: &Self, f: &u32) -> &u32 {
18         f //~ ERROR lifetime mismatch
19     }
20
21     fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
22         f //~ ERROR lifetime mismatch
23     }
24
25     fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
26         f //~ ERROR lifetime mismatch
27     }
28
29     fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
30         f //~ ERROR lifetime mismatch
31     }
32
33     fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
34         f //~ ERROR lifetime mismatch
35     }
36 }
37
38 fn main() { }