Re: [PATCH v7 3/6] rust: types: Support &'static and &'static mut ForeignOwnable

From: Danilo Krummrich
Date: Wed Jun 25 2025 - 04:51:42 EST


On Wed, Jun 25, 2025 at 10:44:27AM +0200, Danilo Krummrich wrote:
> On Tue, Jun 24, 2025 at 11:25:22PM +0000, Matthew Maurer wrote:
> > + fn into_foreign(self) -> *mut Self::PointedTo {
> > + self as *const _ as _
>
> Please prefer
>
> core::ptr::from_ref(self).cast_mut()
>
> instead.

I think in the second impl it can just be:

core::ptr::from_mut(self)

>
> > + }