Re: [PATCH] rust: make `UnsafeCell` the outer type in `Opaque`
From: Alice Ryhl
Date: Wed Jun 14 2023 - 10:37:06 EST
On 6/14/23 16:27, Benno Lossin wrote:>> @@ -258,7 +258,7 @@ pub fn
ffi_init(init_func: impl FnOnce(*mut T)) -> impl PinInit<Self> {
/// Returns a raw pointer to the opaque data.
pub fn get(&self) -> *mut T {
- UnsafeCell::raw_get(self.0.as_ptr())
+ UnsafeCell::get(&self.0).cast::<T>()
Is there a reason you don't do `self.0.get().cast::<T>()`?
Not really. I just modified what was already there.