Re: [PATCH v2 1/1] Make Guard::lock_ref unavailable if Lock is not Sync

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,dev.linux.lists.llvm,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
Hi Priya,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/locking/core]
[also build test ERROR on rust/rust-next linus/master v7.2-rc7 next-20260814]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Priya-Bala-Govindasamy/Make-Guard-lock_ref-unavailable-if-Lock-is-not-Sync/20260814-173656
base:   tip/locking/core
patch link:    https://lore.kernel.org/r/878cfb22ab185874bc363e2b7910a6978af646ab.1782763889.git.pgovind2%40uci.edu
patch subject: [PATCH v2 1/1] Make Guard::lock_ref unavailable if Lock is not Sync
config: arm64-randconfig-003-20260817 (https://download.01.org/0day-ci/archive/20260817/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260817/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> error[E0277]: `T` cannot be sent between threads safely
   --> rust/doctests_kernel_generated.rs:20824:33
   |
   20824 |     assert!(core::ptr::eq(guard.lock_ref(), lock));
   |                                 ^^^^^^^^ `T` cannot be sent between threads safely
   |
   = note: required for `Lock<T, B>` to implement `Sync`
   note: required by a bound in `rust_doctest_kernel_alloc_allocator_rs_0::kernel::sync::lock::Guard::<'a, T, B>::lock_ref`
   --> rust/kernel/sync/lock.rs:239:21
   |
   237 |     pub fn lock_ref(&self) -> &'a Lock<T, B>
   |            -------- required by a bound in this associated function
   238 |     where
   239 |         Lock<T, B>: Sync,
   |                     ^^^^ required by this bound in `Guard::<'a, T, B>::lock_ref`
   help: consider restricting type parameter `T` with trait `Send`
   |
   20822 | fn assert_held<T: core::marker::Send, B: Backend>(guard: &Guard<'_, T, B>, lock: &Lock<T, B>) {
   |                 ++++++++++++++++++++

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.