(self, coerce: F)
| 80 | |
| 81 | #[inline(always)] |
| 82 | unsafe fn __coerce_unchecked<F>(self, coerce: F) -> Gc<'gc, U> |
| 83 | where |
| 84 | F: FnOnce(*mut T) -> *mut U, |
| 85 | { |
| 86 | unsafe { |
| 87 | let ptr = self.ptr.as_ptr() as *mut T; |
| 88 | let ptr = NonNull::new_unchecked(coerce(ptr) as *mut GcBoxInner<U>); |
| 89 | Gc { |
| 90 | ptr, |
| 91 | _invariant: PhantomData, |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | unsafe impl<'gc, T, U: ?Sized> __CoercePtrInternal<GcWeak<'gc, U>> for GcWeak<'gc, T> { |