Re: [PATCH] rust: make `UnsafeCell` the outer type in `Opaque`

From: Miguel Ojeda
Date: Wed Aug 09 2023 - 19:21:50 EST


On Wed, Jun 14, 2023 at 1:53 PM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> When combining `UnsafeCell` with `MaybeUninit`, it is idiomatic to use
> `UnsafeCell` as the outer type. Intuitively, this is because a
> `MaybeUninit<T>` might not contain a `T`, but we always want the effect
> of the `UnsafeCell`, even if the inner value is uninitialized.
>
> Now, strictly speaking, this doesn't really make a difference. The
> compiler will always apply the `UnsafeCell` effect even if the inner
> value is uninitialized. But I think we should follow the convention
> here.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Applied to `rust-next`, thanks everyone!

Cheers,
Miguel