[PATCH v13 2/4] rust: `AlwaysRefCounted` is renamed to `RefCounted`.
Andreas Hindborg
a.hindborg at kernel.org
Mon Feb 2 09:48:39 UTC 2026
Gary Guo <gary at garyguo.net> writes:
> On Mon, 17 Nov 2025 10:07:57 +0000
> Oliver Mangold <oliver.mangold at pm.me> wrote:
>
>> `AlwaysRefCounted` will become a marker trait to indicate that it is
>> allowed to obtain an `ARef<T>` from a `&T`, which cannot be allowed for
>> types which are also Ownable.
>
> The message needs a rationale for making the change rather than relying
> on the reader to deduce so.
>
> For example:
>
> There are types where it may both be referenced counted in some
> cases and owned in other. In such cases, obtaining `ARef<T>`
> from `&T` would be unsound as it allows creation of `ARef<T>`
> copy from `&Owned<T>`.
>
> Therefore, we split `AlwaysRefCounted` into `RefCounted` (which
> `ARef<T>` would require) and a marker trait to indicate that
> the type is always reference counted (and not `Ownable`) so the
> `&T` -> `ARef<T>` conversion is possible.
Thanks, I'll mix this in with the one I sent to Daniel.
Best regards,
Andreas Hindborg
More information about the Linux-security-module-archive
mailing list