aboutsummaryrefslogtreecommitdiffstats
path: root/rust/kernel/debugfs/traits.rs
diff options
context:
space:
mode:
authorBoqun Feng <boqun.feng@gmail.com>2025-10-21 23:42:37 -0400
committerPeter Zijlstra <peterz@infradead.org>2025-10-22 15:21:51 +0200
commit37d0472c8ac441af8bc10fc4959ad9d62dd5fa4c (patch)
tree926feb9ceedafb7e81f2ead64111bf6ba5a023a0 /rust/kernel/debugfs/traits.rs
parentseqlock: Change do_io_accounting() to use scoped_seqlock_read() (diff)
downloadlinux-rng-37d0472c8ac441af8bc10fc4959ad9d62dd5fa4c.tar.xz
linux-rng-37d0472c8ac441af8bc10fc4959ad9d62dd5fa4c.zip
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
Diffstat (limited to 'rust/kernel/debugfs/traits.rs')
-rw-r--r--rust/kernel/debugfs/traits.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/debugfs/traits.rs b/rust/kernel/debugfs/traits.rs
index ab009eb254b3..ba7ec5a900b8 100644
--- a/rust/kernel/debugfs/traits.rs
+++ b/rust/kernel/debugfs/traits.rs
@@ -50,7 +50,7 @@ pub trait Reader {
fn read_from_slice(&self, reader: &mut UserSliceReader) -> Result;
}
-impl<T: FromStr> Reader for Mutex<T> {
+impl<T: FromStr + Unpin> Reader for Mutex<T> {
fn read_from_slice(&self, reader: &mut UserSliceReader) -> Result {
let mut buf = [0u8; 128];
if reader.len() > buf.len() {