Re: [PATCH v10 1/5] rust: types: Add Ownable/Owned types

From: Oliver Mangold
Date: Mon Jun 16 2025 - 07:44:04 EST


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.