From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C35FC88E40 for ; Sun, 13 Sep 2026 09:49:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AABBD10E12B; Sun, 13 Sep 2026 09:49:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="PfBvxpKE"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 96C0610E12B for ; Sun, 13 Sep 2026 09:49:28 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id EB11242AC6; Sun, 13 Sep 2026 09:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1DC51F000FF; Sun, 13 Sep 2026 09:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789292967; bh=Tg5IU0+H9KMkSOpIVEYusfjm6bIb4fQEllwynyz0EVc=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=PfBvxpKEvpJ5VLvXhFNDyHaYXB+ow/oOmmQUHohuPRTQ5OidCuKr72NVna21Lhj74 r5JNth+EicGcrCC7nWRPU3KP7VvVO3pSw3SMgGmOSz4IhFnNf6O4Pe/2yjIehooC1j V5gfQBN3V7CSTiFObippk57pdzCBTAaYjhpBs8h86PcRmrAVE5mHCe8CBXR8sdZ9lI hOiIl8GhtQRUZJhWmq4v0gpGo2yCDfi4JJ5+JCDbKJMzUMLQpHEY7eL23wcPEXXOYK YUZArZv4sXfKDhvHqKab4q5jTSS5LAjaBXREtzk2jtVz45lYaQ3li0P61UqlG1ww9i AGBthjzkxuVUQ== From: Andreas Hindborg To: Gary Guo , Alice Ryhl Cc: Danilo Krummrich , Lorenzo Stoakes , Vlastimil Babka , "Liam R. Howlett" , Uladzislau Rezki , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Benno Lossin , Trevor Gross , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , Onur =?utf-8?Q?=C3=96zkan?= , Lyude Paul , Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Todd Kjos , Christian Brauner , Carlos Llamas , "Rafael J. Wysocki" , Dave Ertman , Leon Romanovsky , Paul Moore , Serge Hallyn , David Airlie , Simona Vetter , Alexander Viro , Jan Kara , Igor Korotin , Viresh Kumar , Nishanth Menon , Stephen Boyd , Bjorn Helgaas , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Pavel Tikhomirov , Michal Wilczynski , Ira Weiny , Matthew Brost , Thomas =?utf-8?Q?Hellstr=C3=B6m?= , Philipp Stanner , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, driver-core@lists.linux.dev, linux-block@vger.kernel.org, linux-security-module@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, linux-pwm@vger.kernel.org, linux-usb@vger.kernel.org, Oliver Mangold , Viresh Kumar Subject: Re: [PATCH v21 4/9] rust: rename `AlwaysRefCounted` to `RefCounted`. In-Reply-To: References: <20260910-unique-ref-v21-0-e83257373062@kernel.org> <20260910-unique-ref-v21-4-e83257373062@kernel.org> Date: Sun, 13 Sep 2026 11:49:12 +0200 Message-ID: <875x09v5uv.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" "Gary Guo" writes: > On Fri Sep 11, 2026 at 10:08 AM BST, Alice Ryhl wrote: >> On Thu, Sep 10, 2026 at 11:01=E2=80=AFAM Andreas Hindborg wrote: >>> >>> From: Oliver Mangold >>> >>> There are types where it may both be reference counted in some cases and >>> owned in others. In such cases, obtaining `ARef` from `&T` would be >>> unsound as it allows creation of `ARef` copy from `&Owned`. >>> >>> Therefore, we split `AlwaysRefCounted` into `RefCounted` (which `ARef` >>> would require) and a marker trait to indicate that the type is always >>> reference counted (and not `Ownable`) so the `&T` -> `ARef` conversi= on >>> 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 >>> Reviewed-by: Daniel Almeida >>> Signed-off-by: Oliver Mangold >>> [ Andreas: Updated commit message and rebase on rust-next (7.2) ] >>> Acked-by: Igor Korotin >>> Acked-by: Danilo Krummrich >>> Acked-by: Viresh Kumar >>> Reviewed-by: Gary Guo >>> Assisted-by: LLM >>> Co-developed-by: Andreas Hindborg >>> Signed-off-by: Andreas Hindborg >> >> 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 d= oes not > have a new `Ownable` form, it should keep saying that "this is always ref= erence > counted". Makes sense, I will fix them. Best regards, Andreas Hindborg