Skip to contentSkip to conversation

linux-next: build failure after merge of the tip tree

PATCH Applied Stephen Rothwell 4 participants 7 messages Oct 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

error[E0594]: cannot assign to data in dereference of lock::Guard<'_, T, MutexBackend>
--> rust/kernel/debugfs/traits.rs:64:9

   |
64 |         *self.lock() = val;
   |         ^^^^^^^^^^^^ cannot assign
   |

= help: trait DerefMut is required to modify through a dereference, but it is not implemented for lock::Guard<'_, T, MutexBackend>

error: aborting due to 1 previous error

For more information about this error, try rustc --explain E0594.

Caused by commit

da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut")

I have used the tip tree from next-20251021 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 2 lines · Stephen Rothwell

Hi all,

Hi Stephen,

Thanks for reporting this.

Cc Mathhew and Danilo,

Quoted 11 lines

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

error[E0594]: cannot assign to data in dereference of lock::Guard<'_, T, MutexBackend>
--> rust/kernel/debugfs/traits.rs:64:9

   |
64 |         *self.lock() = val;
   |         ^^^^^^^^^^^^ cannot assign
   |

= help: trait DerefMut is required to modify through a dereference, but it is not implemented for lock::Guard<'_, T, MutexBackend>

Could we make the impl Reader for Mutex<T> to bound where `T:
Unpin? Since Mutex<T> is structurally pinning T, you cannot use *self.lock() to overwrite T` directly. And that'll fix this.

Thanks!

Regards,
Boqun

Quoted 13 lines

error: aborting due to 1 previous error

For more information about this error, try rustc --explain E0594.

Caused by commit

da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut")

I have used the tip tree from next-20251021 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#2 lore raw
Quoted 10 lines · Boqun Feng
Quoted 2 lines · Stephen Rothwell

Hi all,

Hi Stephen,

Thanks for reporting this.

Cc Mathhew and Danilo,

(now really Cc them...)

Regards,
Boqun

Quoted 36 lines
Quoted 11 lines

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

error[E0594]: cannot assign to data in dereference of lock::Guard<'_, T, MutexBackend>
--> rust/kernel/debugfs/traits.rs:64:9

   |
64 |         *self.lock() = val;
   |         ^^^^^^^^^^^^ cannot assign
   |

= help: trait DerefMut is required to modify through a dereference, but it is not implemented for lock::Guard<'_, T, MutexBackend>

Could we make the impl Reader for Mutex<T> to bound where `T:
Unpin? Since Mutex<T> is structurally pinning T, you cannot use *self.lock() to overwrite T` directly. And that'll fix this.

Thanks!

Regards,
Boqun

Quoted 13 lines

error: aborting due to 1 previous error

For more information about this error, try rustc --explain E0594.

Caused by commit

da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut")

I have used the tip tree from next-20251021 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw

PATCH 1/1 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.

---
 rust/kernel/debugfs/traits.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/debugfs/traits.rs +1 -1
index ab009eb254b3..ba7ec5a900b8 100644
@@ -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() {
Signature · 1 line
2.51.0
maintainer
#4 lore raw

Re: [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin

Quoted 6 lines · Boqun Feng

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.

I assume this can go through the driver-core tree, since it's only about a conflict in linux-next?

maintainer Acked-by
#5 lore raw

Re: [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin

Quoted 10 lines · Danilo Krummrich
Quoted 6 lines · Boqun Feng

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.

I assume this can go through the driver-core tree, since it's only about a conflict in linux-next?

Sorry, I confused this, obviously your tree is broken without this change, please feel free to take it.

merge bot Applied
#6 lore raw

[tip: locking/core] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin

In reply to Boqun Feng
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     37d0472c8ac441af8bc10fc4959ad9d62dd5fa4c
Gitweb:        https://git.kernel.org/tip/37d0472c8ac441af8bc10fc4959ad9d62dd5fa4c
Author:        Boqun Feng <[email protected]>
AuthorDate:    Tue, 21 Oct 2025 23:42:37 -04:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 22 Oct 2025 15:21:51 +02:00

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.

---
 rust/kernel/debugfs/traits.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/debugfs/traits.rs +1 -1
index ab009eb..ba7ec5a 100644
@@ -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() {