From nobody Wed Oct 1 23:27:51 2025 Received: from mail-24418.protonmail.ch (mail-24418.protonmail.ch [109.224.244.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2F752D9EF4; Wed, 1 Oct 2025 09:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.224.244.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759309465; cv=none; b=YkKAUV80+NpQ0JwtVDqMvgZXg7EKbPpueWa227qlDS+rMpZ8DnobYbd7qhfQOcoOwLg1TzF17KfTlI9Q2LNm0cMpOStcoqMOQqyXjLR8vSz29asDD8m+bhBOEx4h/08FdrtdNl8Mp2eOzSXrza4KJ0q19+PVRlkjx0gUJ+zhHMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759309465; c=relaxed/simple; bh=Lau7OAV0t+rECLHLfNwRhmqkvfiQQwtB9F6PCmoc5oI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ic77VQCxJ6IdHdzig0xKLYR5GPDy2t1TUYMwOqgi+MqaLBCp3IImW4fy3CHL05j6Ndn+8hU9fNUIh0iRqerFMTUdnrmCyMHWxZlIyFlTc3mEpJbBjfC/XkYD6k10RjRleN7wxCy7bssKqkqpQdzt2sJNSEfqVFQ+MQvHCOB7uyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=oMmk1RTJ; arc=none smtp.client-ip=109.224.244.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="oMmk1RTJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1759309460; x=1759568660; bh=fssLc+fEIJ9sBuAHQfTYDJPSK2dP+xUCFgdJy3AY7go=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=oMmk1RTJ8/wiD0SCWtIOdeIspDkJJb+oBRz3PvNzwvBuuSWFNAG4caZHfOeJaFUc2 kXlrgCZwBtLMcYpGvTnk2fePqEC6kdvvNTCzu/XTWGWRHaZyWIe9UF5kGa/+OyD2iy BppGHvJeSbsyQ+iv2q7y34i2tO42AdRmjc0G1iF0If85oHo38oHBrTE8C+6Rnry2Gl BxXLON+Ls71xPHV66jpCjIGoXsldN6TgHhlbO/5WyWWR2o74PpvSz7ww+iwTMjWVR9 1YoxJV2BH41U+HLHnz/UF+VYijBHXNgzOOfDd8W0tjNQMJX19L2uvKwDSl8uvRyH0v GLO0p6eNKGVCg== Date: Wed, 01 Oct 2025 09:04:11 +0000 To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Benno Lossin , Danilo Krummrich , Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , "Rafael J. Wysocki" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Alexander Viro , Christian Brauner , Jan Kara , Lorenzo Stoakes , "Liam R. Howlett" , Viresh Kumar , Nishanth Menon , Stephen Boyd , Bjorn Helgaas , =?utf-8?Q?Krzysztof_Wilczy=C5=84ski?= , Asahi Lina From: Oliver Mangold Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, Oliver Mangold Subject: [PATCH v12 3/4] rust: Add missing SAFETY documentation for `ARef` example Message-ID: <20251001-unique-ref-v12-3-fa5c31f0c0c4@pm.me> In-Reply-To: <20251001-unique-ref-v12-0-fa5c31f0c0c4@pm.me> References: <20251001-unique-ref-v12-0-fa5c31f0c0c4@pm.me> Feedback-ID: 31808448:user:proton X-Pm-Message-ID: 8ab9517ccdb9c0bc9ac966b0661995277141b944 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" SAFETY comment in rustdoc example was just 'TODO'. Fixed. Signed-off-by: Oliver Mangold --- rust/kernel/sync/aref.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust/kernel/sync/aref.rs b/rust/kernel/sync/aref.rs index e029b4c046449a6b0bb61bb6369ac26f9495b2ad..97cfddd9ec2ad788a4a659f404a= 9b6790da08e29 100644 --- a/rust/kernel/sync/aref.rs +++ b/rust/kernel/sync/aref.rs @@ -119,7 +119,9 @@ pub unsafe fn from_raw(ptr: NonNull) -> Self { /// /// struct Empty {} /// - /// # // SAFETY: TODO. + /// // SAFETY: The `RefCounted` implementation for `Empty` does not co= unt references and + /// // never frees the underlying object. Thus we can act as having a = refcount on the object + /// // that we pass to the newly created `ARef`. /// unsafe impl RefCounted for Empty { /// fn inc_ref(&self) {} /// unsafe fn dec_ref(_obj: NonNull) {} @@ -127,7 +129,7 @@ pub unsafe fn from_raw(ptr: NonNull) -> Self { /// /// let mut data =3D Empty {}; /// let ptr =3D NonNull::::new(&mut data).unwrap(); - /// # // SAFETY: TODO. + /// // SAFETY: We keep `data` around longer than the `ARef`. /// let data_ref: ARef =3D unsafe { ARef::from_raw(ptr) }; /// let raw_ptr: NonNull =3D ARef::into_raw(data_ref); /// --=20 2.51.0