Re: [PATCH v3] rust: locks: Add `get_mut` method to `Lock`
From: Alice Ryhl
Date: Fri Feb 23 2024 - 05:49:38 EST
On Fri, Feb 23, 2024 at 3:52 AM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
> BTW, while we are at it, I think we should document the
> "structural/non-structural pinning" design decisions somewhere, for
> example in the struct definition:
>
> #[pin_data]
> pub struct Lock<T: ?Sized, B: Backend> {
> ...
> /// The data protected by the lock.
> /// This field is non-structural pinned.
> pub(crate) data: UnsafeCell<T>,
> }
>
> Thoughts? Or do we think "non-structural pinned" should be the default
> case so no need to document it? I want to have a clear document for each
> field to avoid the accidental "everyone forgets what's the decision
> here" ;-)
I would normally assume that "field is not marked #[pin]" implies that
it's not structurally pinned. But it could still be worth to call out
here.
I prefer the wording "not structurally pinnned" over "non-structural pinned".
Alice