[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87zfe68uh4.fsf@kernel.org>
Date: Tue, 17 Jun 2025 13:42:47 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Oliver Mangold" <oliver.mangold@...me>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno
Lossin" <benno.lossin@...ton.me>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Asahi Lina" <lina@...hilina.net>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v10 1/5] rust: types: Add Ownable/Owned types
"Oliver Mangold" <oliver.mangold@...me> writes:
> On 250502 1157, Andreas Hindborg wrote:
>> > +
>> > +impl<T: Ownable> Owned<T> {
>> > + /// Creates a new instance of [`Owned`].
>> > + ///
>> > + /// It takes over ownership of the underlying object.
>> > + ///
>> > + /// # Safety
>> > + ///
>> > + /// Callers must ensure that the underlying object is acquired and can be considered owned by
>> > + /// Rust.
>>
>>
>> This part "the underlying object is acquired" is unclear to me. How about:
>>
>> Callers must ensure that *ownership of* the underlying object has been
>> acquired. That is, the object can be considered owned by the caller.
>>
>>
>
> Yes, made me think about the phrasing, too. But the main point is, that the
> object must be considered to be owned by the `Owned<T>` after the function
> call, no?
>
> So maybe:
>
> Callers must ensure that ownership of the underlying object can be
> transfered to the `Owned<T>` and must consider it to be transfered
> after the function call. This usually implies that the object
> most not be accessed through `ptr` anymore.
Sounds good to me 👍
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists