[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DC6KO9DJG36S.TQRLQQGJKVON@kernel.org>
Date: Tue, 19 Aug 2025 19:15:34 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Andreas Hindborg" <a.hindborg@...nel.org>, "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>, "Alice Ryhl" <aliceryhl@...gle.com>, "Trevor
Gross" <tmgross@...ch.edu>, "Asahi Lina" <lina+kernel@...hilina.net>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v11 1/4] rust: types: Add Ownable/Owned types
On Tue Aug 19, 2025 at 11:00 AM CEST, Andreas Hindborg wrote:
> "Oliver Mangold" <oliver.mangold@...me> writes:
>> You mean of `Ownable`, when `OwnableMut` is removed? Yes. A good question
>> in that context is, what it actually means to have an `&mut Opaque<T>`
>> where `T` is `Unpin`. If that implies being allowed to obtain an `&mut T`,
>> it would we easy, I guess.
>
> You should not be able to get a `&mut T` from a `&mut Opaque<T>`.
> `Opaque` opts out of invariants that normally hold for rust references.
Yes, that function mustn't exist.
>> But what I am wondering is, if we actually want to start using `Pin`
>> at all. Isn't `Opaque` currently used about everywhere pinning is needed?
>
> `Opaque` is `!Unpin`, but pinning guarantees does not come into effect
> until we produce a `Pin<Opaque<T>>`.
`Pin<Opaque<T>>` isn't really a thing. You still need a pointer
indirection, so `Pin<P>` where `P: DerefMut<Target = Opaque<T>>` so for
example `Pin<Box<Opaque<T>>>`.
---
Cheers,
Benno
Powered by blists - more mailing lists