[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLghF-B3eGnN3yQ_eZRWWMQa-CLDZea6hgFM3uS=n-GNyzg@mail.gmail.com>
Date: Fri, 8 Nov 2024 17:34:22 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Tamir Duberstein <tamird@...il.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/6] rust: types: avoid `as` casts
On Fri, Nov 8, 2024 at 4:46 PM Tamir Duberstein <tamird@...il.com> wrote:
>
> Replace `as` casts with `cast{,_mut}` calls which are a bit safer.
>
> In one instance, remove an unnecessary `as` cast without replacement.
>
> Signed-off-by: Tamir Duberstein <tamird@...il.com>
One question below, but either way:
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> @@ -333,13 +334,13 @@ impl<T: 'static> ForeignOwnable for Arc<T> {
> type Borrowed<'a> = ArcBorrow<'a, T>;
>
> fn into_foreign(self) -> *const core::ffi::c_void {
> - ManuallyDrop::new(self).ptr.as_ptr() as _
> + ManuallyDrop::new(self).ptr.as_ptr().cast_const().cast()
What's up with this cast_const?
Alice
Powered by blists - more mailing lists