linux-next: build failure after merge of the tip tree
Subsystems (3)
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
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_64allmodconfig) 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
DerefMutis required to modify through a dereference, but it is not implemented forlock::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
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_64allmodconfig) 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
DerefMutis required to modify through a dereference, but it is not implemented forlock::Guard<'_, T, MutexBackend>Could we make the
impl ReaderforMutex<T>to bound where `T:
Unpin? SinceMutex<T>is structurally pinningT, you cannot use*self.lock()to overwriteT` directly. And that'll fix this.Thanks!
Regards,
BoqunQuoted 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
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
@@ -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
Danilo Krummrich
maintainerRe: [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 aGuardthat can dereference a mutable reference toTif onlyTisUnpin, therefore restrict the implReaderblock ofMutex<T>to that.Signed-off-by Boqun Feng <[email protected]>
I assume this can go through the driver-core tree, since it's only about a conflict in linux-next?
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 aGuardthat can dereference a mutable reference toTif onlyTisUnpin, therefore restrict the implReaderblock ofMutex<T>to that.Signed-off-by Boqun Feng <[email protected]>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.
[tip: locking/core] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin
In reply to Boqun FengThe 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
@@ -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 () {