[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <CQV7YQW9HU8R.2HH07UP1OA6Y1@vincent-arch>
Date: Wed, 01 Mar 2023 18:23:14 +0100
From: "Vincenzo Palazzo" <vincenzopalazzodev@...il.com>
To: "Asahi Lina" <lina@...hilina.net>,
"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>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<asahi@...ts.linux.dev>
Subject: Re: [PATCH 2/2] rust: sync: arc: Add
UniqueArc<MaybeUninit<T>::assume_init()
> 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.
>
> Signed-off-by: Asahi Lina <lina@...hilina.net>
> ---
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@...il.com>
Powered by blists - more mailing lists