[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgjpYPBwoE10eschOVnepbYmcEKtaZkWyPT8ZXG2wGrruQ@mail.gmail.com>
Date: Tue, 22 Oct 2024 13:04:29 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Miguel Ojeda <ojeda@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>
Cc: Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, Andreas Hindborg <a.hindborg@...nel.org>
Subject: Re: [PATCH v5] rust: add global lock support
On Mon, Oct 21, 2024 at 3:18 PM Alice Ryhl <aliceryhl@...gle.com> wrote:
> + /// Lock this global lock.
> + pub fn lock(&'static self) -> GuardTyp {
> + $crate::global_lock_inner!(new_guard $($guard)? {
> + self.inner.lock()
> + })
> + }
> +
> + /// Lock this global lock.
> + #[allow(clippy::needless_question_mark)]
> + pub fn try_lock(&'static self) -> Option<GuardTyp> {
> + Some($crate::global_lock_inner!(new_guard $($guard)? {
> + self.inner.try_lock()?
> + }))
> + }
It came up during the meeting that these should just be pub, but now I
remember why I didn't do that. Making them pub means that you now get
"private type `MyCustomstruct` in public interface" errors on
whichever custom struct you're using as the item type of the lock.
And this error isn't a lint you can silence!
Alice
Powered by blists - more mailing lists