Skip to contentSkip to conversation

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

PATCH Applied Danilo Krummrich 2 participants 3 messages Nov 7, 2025

Subsystems (2)
lore
Share & tools
lore

Danilo Krummrich

author maintainer
#0 lore raw

PATCH 1/1 rust: debugfs: Implement BinaryReader for Mutex<T> only when T is Unpin

Commit da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut") from tip/master adds an Unpin bound to T for Mutex<T>, hence also restrict the implementation of BinaryReader for Mutex<T> accordingly.

---
 rust/kernel/debugfs/traits.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/debugfs/traits.rs +1 -1
index 2c32ddf9826f..82441ac8adaa 100644
@@ -257,7 +257,7 @@ fn read_from_slice(
 }
 
 // Delegate for `Mutex<T>`: Support a `T` with an outer `Mutex`.
-impl<T: BinaryReaderMut> BinaryReader for Mutex<T> {
+impl<T: BinaryReaderMut + Unpin> BinaryReader for Mutex<T> {
     fn read_from_slice(
         &self,
         reader: &mut UserSliceReader,
Signature · 1 line
2.51.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Danilo Krummrich

Commit da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut") from tip/master adds an Unpin bound to T for Mutex<T>, hence also restrict the implementation of BinaryReader for Mutex<T> accordingly.

author maintainer Applied
#2 lore raw
In reply to Danilo Krummrich
Quoted 8 lines · Danilo Krummrich

Commit da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut") from tip/master adds an Unpin bound to T for Mutex<T>, hence also restrict the implementation of BinaryReader for Mutex<T> accordingly.

Applied to driver-core-next, thanks!