On Fri Sep 11, 2026 at 10:08 AM BST, Alice Ryhl wrote: > On Thu, Sep 10, 2026 at 11:01 AM Andreas Hindborg <[email protected]> > wrote: >> >> From: Oliver Mangold <[email protected]> >> >> There are types where it may both be reference counted in some cases and >> owned in others. 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. >> >> - Rename `AlwaysRefCounted` to `RefCounted`. >> - Add a new unsafe trait `AlwaysRefCounted`. >> - Implement the new trait `AlwaysRefCounted` for the newly renamed >> `RefCounted` implementations. This leaves functionality of existing >> implementers of `AlwaysRefCounted` intact. >> >> Suggested-by: Alice Ryhl <[email protected]> >> Reviewed-by: Daniel Almeida <[email protected]> >> Signed-off-by: Oliver Mangold <[email protected]> >> [ Andreas: Updated commit message and rebase on rust-next (7.2) ] >> Acked-by: Igor Korotin <[email protected]> >> Acked-by: Danilo Krummrich <[email protected]> >> Acked-by: Viresh Kumar <[email protected]> >> Reviewed-by: Gary Guo <[email protected]> >> Assisted-by: LLM >> Co-developed-by: Andreas Hindborg <[email protected]> >> Signed-off-by: Andreas Hindborg <[email protected]> > > This has a lot of safety comments of the form "This does not implement > Ownable, *therefore* it can implement AlwaysRefcounted". But I think > the safety comment should instead explain that it's okay to create an > ARef<_> from an &_ for this type. The fact that Ownable is not > implemented is not sufficient argument. > > Alice
Yeah, I think for types that currently implement `AlwaysRefCounted` and does not have a new `Ownable` form, it should keep saying that "this is always reference counted". Best, Gary
