rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
To: lina@asahilina.net
Cc: alex.gaynor@gmail.com, asahi@lists.linux.dev,
	bjorn3_gh@protonmail.com, boqun.feng@gmail.com, gary@garyguo.net,
	linux-kernel@vger.kernel.org, ojeda@kernel.org,
	rust-for-linux@vger.kernel.org, wedsonaf@gmail.com
Subject: Re: [PATCH 2/2] rust: sync: arc: Add UniqueArc<MaybeUninit<T>::assume_init()
Date: Fri, 24 Feb 2023 11:37:01 -0300	[thread overview]
Message-ID: <20230224143701.755103-1-yakoyoku@gmail.com> (raw)
In-Reply-To: <20230224-rust-arc-v1-2-568eea613a41@asahilina.net>

On Fri, Feb 24, 2023 at 04:59:34PM +0900, Asahi Lina wrote:
> We can already create `UniqueArc<MaybeUninit<T>>` instances with
> `UniqueArc::try_new_uninit()` and write to them with `write()`. Add
> the missing unsafe `assume_init()` function to promote it to
> `UniqueArc<T>`, so users can do piece-wise initialization of the
> contents instead of doing it all at once as long as they keep the
> invariants (the same requirements as `MaybeUninit::assume_init()`).
> 
> This mirrors the std `Arc::assume_init()` function. In the kernel,
> since we have `UniqueArc`, arguably this only belongs there since most
> use cases will initialize it immediately after creating it, before
> demoting it to `Arc` to share it.

Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>

  reply	other threads:[~2023-02-24 14:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  7:59 [PATCH 0/2] rust: sync: Arc: Any downcasting and assume_init() Asahi Lina
2023-02-24  7:59 ` [PATCH 1/2] rust: sync: arc: implement Arc<dyn Any + Send + Sync>::downcast() Asahi Lina
2023-02-24 14:34   ` Martin Rodriguez Reboredo
2023-02-25  0:43   ` Gary Guo
2023-02-27 11:46   ` Andreas Hindborg
2023-03-01 17:22   ` Vincenzo Palazzo
2023-02-24  7:59 ` [PATCH 2/2] rust: sync: arc: Add UniqueArc<MaybeUninit<T>::assume_init() Asahi Lina
2023-02-24 14:37   ` Martin Rodriguez Reboredo [this message]
2023-02-25  0:41   ` Gary Guo
2023-02-27 11:48   ` Andreas Hindborg
2023-03-01 17:23   ` Vincenzo Palazzo

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=20230224143701.755103-1-yakoyoku@gmail.com \
    --to=yakoyoku@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=asahi@lists.linux.dev \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=lina@asahilina.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;
as well as URLs for NNTP newsgroup(s).