Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin

Since we are going to make `Mutex<T>` structurally pin the data (i.e.
`T`), therefore `.lock()` function only returns a `Guard` that can
dereference a mutable reference to `T` if only `T` is `Unpin`, therefore
restrict the impl `Reader` block of `Mutex<T>` to that.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20251022034237.70431-1-boqun.feng@gmail.com

authored by

Boqun Feng and committed by
Peter Zijlstra
37d0472c 795aab35

+1 -1
+1 -1
rust/kernel/debugfs/traits.rs
··· 50 50 fn read_from_slice(&self, reader: &mut UserSliceReader) -> Result; 51 51 } 52 52 53 - impl<T: FromStr> Reader for Mutex<T> { 53 + impl<T: FromStr + Unpin> Reader for Mutex<T> { 54 54 fn read_from_slice(&self, reader: &mut UserSliceReader) -> Result { 55 55 let mut buf = [0u8; 128]; 56 56 if reader.len() > buf.len() {