]> git.proxmox.com Git - rustc.git/blob - tests/ui/self/elision/multiple-ref-self.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / self / elision / multiple-ref-self.rs
1 // check-pass
2
3 #![feature(arbitrary_self_types)]
4 #![allow(non_snake_case)]
5
6 use std::marker::PhantomData;
7 use std::ops::Deref;
8 use std::pin::Pin;
9
10 struct Struct { }
11
12 struct Wrap<T, P>(T, PhantomData<P>);
13
14 impl<T, P> Deref for Wrap<T, P> {
15 type Target = T;
16 fn deref(&self) -> &T { &self.0 }
17 }
18
19 impl Struct {
20 // Test using multiple `&Self`:
21
22 fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
23 f
24 }
25
26 fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
27 f
28 }
29
30 fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
31 f
32 }
33
34 fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
35 f
36 }
37
38 fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
39 f
40 }
41 }
42
43 fn main() { }