[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLgj3fZpHQ3Mxz-1tNgmR_Y9Cpqrxwo2HeT+QT36bYoD0xA@mail.gmail.com>
Date: Tue, 27 Aug 2024 10:44:20 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...sung.com>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: add global lock support
On Mon, Aug 26, 2024 at 5:46 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>
> On 26.08.24 17:31, Alice Ryhl wrote:
> > On Mon, Aug 26, 2024 at 5:30 PM Benno Lossin <benno.lossin@...ton.me> wrote:
> >> On 26.08.24 17:27, Alice Ryhl wrote:
> >>> + /// Initialize a global lock.
> >>> + ///
> >>> + /// # Safety
> >>> + ///
> >>> + /// * This lock must have been created with [`unsafe_const_new`].
> >>> + /// * This lock must be pinned.
> >>
> >> You could also ask for `self: Pin<&Self>` and remove this constraint, or
> >> is that not possible in your use-case?
> >
> > The value is going to be in a static, and it's inconvenient to have to
> > use Pin::new_unchecked when calling this initializer. Not sure much
> > value is gained.
>
> Can't you use `Pin::static_ref` [1]?
>
> [1]: https://doc.rust-lang.org/std/pin/struct.Pin.html#method.static_ref
That's an excellent point, thanks. Sent a new version with that.
Alice
Powered by blists - more mailing lists