[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgiaxPyC88wCvm4-2zSxx=O+q+eji-guB_tpRXM__Do+Dw@mail.gmail.com>
Date: Thu, 6 Feb 2025 13:18:22 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Danilo Krummrich <dakr@...nel.org>, 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>, Trevor Gross <tmgross@...ch.edu>,
Joel Becker <jlbec@...lplan.org>, Christoph Hellwig <hch@....de>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, Tamir Duberstein <tamird@...il.com>
Subject: Re: [PATCH 1/4] rust: types: add `ForeignOwnable::PointedTo`
On Fri, Jan 31, 2025 at 2:32 PM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
> From: Tamir Duberstein <tamird@...il.com>
>
> Allow implementors to specify the foreign pointer type; this exposes
> information about the pointed-to type such as its alignment.
>
> This requires the trait to be `unsafe` since it is now possible for
> implementors to break soundness by returning a misaligned pointer.
>
> Encoding the pointer type in the trait (and avoiding pointer casts)
> allows the compiler to check that implementors return the correct
> pointer type. This is preferable to directly encoding the alignment in
> the trait using a constant as the compiler would be unable to check it.
>
> Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
> Signed-off-by: Tamir Duberstein <tamird@...il.com>
> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
I would have gone a different route with this API, but I won't block it.
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
Powered by blists - more mailing lists