Re: [PATCH v7] rust: transmute: Add methods for FromBytes trait
From: kernel test robot
Date: Sun Jun 15 2025 - 13:13:43 EST
Hi Every2,
kernel test robot noticed the following build errors:
[auto build test ERROR on rust/rust-next]
[also build test ERROR on linus/master v6.16-rc1 next-20250613]
[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/Every2/rust-transmute-Add-methods-for-FromBytes-trait/20250615-152228
base: https://github.com/Rust-for-Linux/linux rust-next
patch link: https://lore.kernel.org/r/20250615072042.133290-1-christiansantoslima21%40gmail.com
patch subject: [PATCH v7] rust: transmute: Add methods for FromBytes trait
config: um-randconfig-001-20250615 (https://download.01.org/0day-ci/archive/20250616/202506160013.MgafgaAm-lkp@xxxxxxxxx/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250616/202506160013.MgafgaAm-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506160013.MgafgaAm-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
>> error[E0046]: not all trait items implemented, missing: `from_bytes`, `from_mut_bytes`
--> rust/doctests_kernel_generated.rs:3156:1
|
3156 | unsafe impl kernel::transmute::FromBytes for MyStruct{};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_bytes`, `from_mut_bytes` in implementation
|
= help: implement the missing item: `fn from_bytes(_: &[u8]) -> Option<&Self> { todo!() }`
= help: implement the missing item: `fn from_mut_bytes<Self>(_: &mut [u8]) -> Option<&mut Self> where Self: AsBytes { todo!() }`
--
>> error[E0046]: not all trait items implemented, missing: `from_bytes`, `from_mut_bytes`
--> rust/doctests_kernel_generated.rs:3221:1
|
3221 | unsafe impl kernel::transmute::FromBytes for MyStruct{};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_bytes`, `from_mut_bytes` in implementation
|
= help: implement the missing item: `fn from_bytes(_: &[u8]) -> Option<&Self> { todo!() }`
= help: implement the missing item: `fn from_mut_bytes<Self>(_: &mut [u8]) -> Option<&mut Self> where Self: AsBytes { todo!() }`
--
>> error[E0599]: no function or associated item named `from_bytes` found for type `u32` in the current scope
--> rust/doctests_kernel_generated.rs:9216:19
|
9216 | let result = u32::from_bytes(&arr);
| ^^^^^^^^^^ function or associated item not found in `u32`
|
= help: items from traits can only be used if the trait is in scope
help: trait `FromBytes` which provides `from_bytes` is implemented but not in scope; perhaps you want to import it
|
3 + use crate::rust_doctest_kernel_alloc_kbox_rs_7::kernel::transmute::FromBytes;
|
help: there is an associated function `from_be` with a similar name
|
9216 | let result = u32::from_be(&arr);
| ~~~~~~~
--
>> error[E0046]: not all trait items implemented, missing: `from_bytes`, `from_mut_bytes`
--> samples/rust/rust_dma.rs:35:1
|
35 | unsafe impl kernel::transmute::FromBytes for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_bytes`, `from_mut_bytes` in implementation
|
= help: implement the missing item: `fn from_bytes(_: &[u8]) -> Option<&Self> { todo!() }`
= help: implement the missing item: `fn from_mut_bytes<Self>(_: &mut [u8]) -> Option<&mut Self> where Self: AsBytes { todo!() }`
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki