[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62158f09-2882-475e-9df5-6d5f26d788ff@proton.me>
Date: Tue, 06 Aug 2024 14:11:30 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...sung.com>, Marco Elver <elver@...gle.com>, Coly Li <colyli@...e.de>, Paolo Abeni <pabeni@...hat.com>, Pierre Gondois <pierre.gondois@....com>, Ingo Molnar <mingo@...nel.org>, Jakub Kicinski <kuba@...nel.org>, Wei Yang <richard.weiyang@...il.com>, Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH v3 02/10] rust: list: add ListArc
On 06.08.24 15:16, Alice Ryhl wrote:
> On Wed, Jul 31, 2024 at 6:47 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>> On 23.07.24 10:22, Alice Ryhl wrote:
>>> + // INVARIANT: By the safety requirements, the invariants on `ListArc` are satisfied.
>>> + Self { arc }
>>> + }
>>> +
>>> + /// Transmutes a `ListArc` into an [`Arc`] without updating the tracking inside `T`.
>>> + ///
>>> + /// After this call, the tracking inside `T` will still think that there is a `ListArc`
>>> + /// reference.
>>> + #[inline]
>>> + fn transmute_to_arc(self) -> Arc<T> {
>>
>> Maybe also change this then to be consistent, since the name `transmute`
>> carries a "dangerous" feel to it, but this is actually totally safe.
>
> I want it to carry a dangerous feel! Yes, it's safe to leak the
> ListArc, but you don't want people to think it's a generic ListArc ->
> Arc conversion function.
For me `to_arc_unchecked` would also "feel" dangerous, transmute is just
more dangerous :)
Since this is not public I don't mind keeping `transmute`, I just find
it a bit strange.
---
Cheers,
Benno
Powered by blists - more mailing lists