Rust for Linux List
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: add global lock support
Date: Mon, 26 Aug 2024 15:46:12 +0000	[thread overview]
Message-ID: <91ce9f9a-5def-4f5a-ab9d-9bde4736cca0@proton.me> (raw)
In-Reply-To: <CAH5fLgjtSVMcKL4aMrNT=zJPGvzAPJt3qAUMYdB-+3=s80FNKQ@mail.gmail.com>

On 26.08.24 17:31, Alice Ryhl wrote:
> On Mon, Aug 26, 2024 at 5:30 PM Benno Lossin <benno.lossin@proton.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

---
Cheers,
Benno


  reply	other threads:[~2024-08-26 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 15:27 [PATCH] rust: add global lock support Alice Ryhl
2024-08-26 15:30 ` Benno Lossin
2024-08-26 15:31   ` Alice Ryhl
2024-08-26 15:46     ` Benno Lossin [this message]
2024-08-27  8:44       ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91ce9f9a-5def-4f5a-ab9d-9bde4736cca0@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox