diff --git a/helper_crates/vtable/src/lib.rs b/helper_crates/vtable/src/lib.rs index f87eb77bc..02cb1a0e1 100644 --- a/helper_crates/vtable/src/lib.rs +++ b/helper_crates/vtable/src/lib.rs @@ -296,11 +296,6 @@ impl<'a, T: ?Sized + VTableMeta> VRef<'a, T> { None } } - - /// Return a Pin reference to the target, with the same lifetime - pub fn as_pin_ref(this: Pin) -> Pin<&'a T::Target> { - unsafe { Pin::new_unchecked(&*Pin::into_inner_unchecked(this).inner.deref::()) } - } } /// `VRefMut<'a MyTraitVTable>` can be thought as a `&'a mut dyn MyTrait` @@ -376,15 +371,6 @@ impl<'a, T: ?Sized + VTableMeta> VRefMut<'a, T> { None } } - - /// Return a Pin reference to the target, with the same lifetime - pub fn as_pin_ref(this: Pin) -> Pin<&'a mut T::Target> { - unsafe { - Pin::new_unchecked( - &mut *(Pin::into_inner_unchecked(this).inner.deref::() as *mut T::Target), - ) - } - } } /** Creates a `VRef` or a `VRefMut` suitable for an instance that implements the trait diff --git a/sixtyfps_runtime/interpreter/dynamic_component.rs b/sixtyfps_runtime/interpreter/dynamic_component.rs index 0f9ba7137..b66b2a938 100644 --- a/sixtyfps_runtime/interpreter/dynamic_component.rs +++ b/sixtyfps_runtime/interpreter/dynamic_component.rs @@ -224,7 +224,10 @@ impl Component for ErasedComponentBox { self.borrow().as_ref().apply_layout(r) } fn get_item_ref<'a>(self: Pin<&'a Self>, index: usize) -> Pin> { - vtable::VRef::as_pin_ref(self.get_ref().borrow()).get_item_ref(index) + // We're having difficulties transferring the lifetime to a pinned reference + // to the other ComponentVTable with the same life time. So skip the vtable + // indirection and call our implementation directly. + unsafe { get_item_ref(self.get_ref().borrow(), index) } } }