Re: [PATCH v3 02/10] rust: list: add ListArc

From: Benno Lossin
Date: Tue Aug 06 2024 - 10:11:59 EST


On 06.08.24 15:16, Alice Ryhl wrote:
> On Wed, Jul 31, 2024 at 6:47 PM Benno Lossin <benno.lossin@xxxxxxxxx> 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