]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: sync: Implement Unpin for ARef
authorAlice Ryhl <aliceryhl@google.com>
Thu, 18 Dec 2025 08:25:13 +0000 (08:25 +0000)
committerBoqun Feng <boqun.feng@gmail.com>
Fri, 9 Jan 2026 11:01:40 +0000 (19:01 +0800)
commit09248ed8cdb6345afc883c02aecd79dfbd9c2a9c
treebad3473cd049a6a743193f9874e88ab39f004503
parent8a581130b1cbc17c702298b8325e3df98c792760
rust: sync: Implement Unpin for ARef

The default implementation of Unpin for ARef<T> is conditional on T
being Unpin due to its PhantomData<T> field. However, this is overly
strict as pointers to T are legal to move even if T itself cannot move.

Since commit 66f1ea83d9f8 ("rust: lock: Add a Pin<&mut T> accessor")
this causes build failures when combined with a Mutex that contains an
field ARef<T>, because almost any type that ARef is used with is !Unpin.

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20251218-unpin-for-aref-v2-1-30d77129cbc6@google.com
rust/kernel/sync/aref.rs