2 #![feature(arbitrary_self_types)]
3 #![feature(rustc_attrs)]
12 fn by_rc(self: Rc<Self>) -> i64;
13 fn by_arc(self: Arc<Self>) -> i64;
14 fn by_pin_mut(self: Pin<&mut Self>) -> i64;
15 fn by_pin_box(self: Pin<Box<Self>>) -> i64;
16 fn by_pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> i64;
20 fn by_rc(self: Rc<Self>) -> i64 {
23 fn by_arc(self: Arc<Self>) -> i64 {
26 fn by_pin_mut(self: Pin<&mut Self>) -> i64 {
29 fn by_pin_box(self: Pin<Box<Self>>) -> i64 {
32 fn by_pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> i64 {
38 let rc = Rc::new(1i64) as Rc<dyn Trait>;
39 assert_eq!(1, rc.by_rc());
41 let arc = Arc::new(2i64) as Arc<dyn Trait>;
42 assert_eq!(2, arc.by_arc());
45 let pin_mut = Pin::new(&mut value) as Pin<&mut dyn Trait>;
46 assert_eq!(3, pin_mut.by_pin_mut());
48 let pin_box = Into::<Pin<Box<i64>>>::into(Box::new(4i64)) as Pin<Box<dyn Trait>>;
49 assert_eq!(4, pin_box.by_pin_box());
52 let pin_pin_pin_ref = Pin::new(Pin::new(Pin::new(&value))) as Pin<Pin<Pin<&dyn Trait>>>;
53 assert_eq!(5, pin_pin_pin_ref.by_pin_pin_pin_ref());