]> Gentwo Git Trees - linux/.git/commit
rust: lock: Pin the inner data
authorDaniel Almeida <daniel.almeida@collabora.com>
Fri, 19 Sep 2025 09:12:40 +0000 (11:12 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 21 Oct 2025 10:31:55 +0000 (12:31 +0200)
commit2497a7116ff9a051d0e78885a27a52213bc2841d
tree09689c4e5d782bdb7fd79809d972d4b7c78cac15
parentda123f0ee40f0e5a3791bbaf58a1db1744c59f72
rust: lock: Pin the inner data

In preparation to support Lock<T> where T is pinned, the first thing
that needs to be done is to structurally pin the 'data' member. This
switches the 't' parameter in Lock<T>::new() to take in an impl
PinInit<T> instead of a plain T. This in turn uses the blanket
implementation "impl PinInit<T> for T".

Subsequent patches will touch on Guard<T>.

Suggested-by: Benno Lossin <lossin@kernel.org>
Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1181
rust/kernel/sync/lock.rs