diff --git a/vm/src/pyobjectrc.rs b/vm/src/pyobjectrc.rs index 02999e510..cfff137c4 100644 --- a/vm/src/pyobjectrc.rs +++ b/vm/src/pyobjectrc.rs @@ -57,11 +57,11 @@ type OnceBox = once_cell::unsync::OnceCell>; struct Erased; struct PyObjVTable { - drop_dealloc: unsafe fn(&mut PyObject), + drop_dealloc: unsafe fn(*mut PyObject), debug: unsafe fn(&PyObject, &mut fmt::Formatter) -> fmt::Result, } -unsafe fn drop_dealloc_obj(x: &mut PyObject) { - Box::from_raw(x as *mut PyObject as *mut PyInner); +unsafe fn drop_dealloc_obj(x: *mut PyObject) { + Box::from_raw(x as *mut PyInner); } unsafe fn debug_obj(x: &PyObject, f: &mut fmt::Formatter) -> fmt::Result { let x = &*(x as *const PyObject as *const PyInner); @@ -683,7 +683,7 @@ impl PyObjectRef { } let drop_dealloc = self.0.vtable.drop_dealloc; - unsafe { drop_dealloc(self.ptr.as_mut()) } + unsafe { drop_dealloc(self.ptr.as_ptr()) } } }