public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Miguel Ojeda <ojeda@kernel.org>, Greg KH <greg@kroah.com>,
	Danilo Krummrich <dakr@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Igor Korotin <igor.korotin.linux@gmail.com>,
	Tamir Duberstein <tamird@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: linux-next: manual merge of the rust tree with the driver-core tree
Date: Thu, 20 Nov 2025 18:11:11 +1100	[thread overview]
Message-ID: <20251120181111.65ce75a0@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 4416 bytes --]

Hi all,

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

error[E0599]: no method named `len_with_nul` found for reference `&'static ffi::CStr` in the current scope
  --> rust/kernel/i2c.rs:48:16
   |
48 |             id.len_with_nul() <= Self::I2C_NAME_SIZE,
   |                ^^^^^^^^^^^^ method not found in `&CStr`

error[E0599]: no method named `as_bytes_with_nul` found for reference `&'static ffi::CStr` in the current scope
  --> rust/kernel/i2c.rs:51:22
   |
51 |         let src = id.as_bytes_with_nul();
   |                      ^^^^^^^^^^^^^^^^^
   |
help: there is a method `to_bytes_with_nul` with a similar name
   |
51 |         let src = id.to_bytes_with_nul();
   |                      ~~~~~~~~~~~~~~~~~

error[E0599]: no method named `len_with_nul` found for reference `&'static ffi::CStr` in the current scope
   --> rust/kernel/i2c.rs:438:19
    |
438 |             type_.len_with_nul() <= Self::I2C_TYPE_SIZE,
    |                   ^^^^^^^^^^^^ method not found in `&CStr`

error[E0599]: no method named `as_bytes_with_nul` found for reference `&'static ffi::CStr` in the current scope
   --> rust/kernel/i2c.rs:441:25
    |
441 |         let src = type_.as_bytes_with_nul();
    |                         ^^^^^^^^^^^^^^^^^
    |
help: there is a method `to_bytes_with_nul` with a similar name
    |
441 |         let src = type_.to_bytes_with_nul();
    |                         ~~~~~~~~~~~~~~~~~

error: aborting due to 4 previous errors

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

Caused by commit

  3b83f5d5e78a ("rust: replace `CStr` with `core::ffi::CStr`")

interacting with commits

  f3cc26a417b7 ("rust: i2c: add manual I2C device creation abstractions")
  57c5bd9aee94 ("rust: i2c: add basic I2C device and driver abstractions")

from the driver-core tree.

I have applied the following (hack) merge resolution for today.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 20 Nov 2025 17:01:06 +1100
Subject: [PATCH] fix up 2 for "rust: replace `CStr` with `core::ffi::CStr`"

interacting with commits

  f3cc26a417b7 ("rust: i2c: add manual I2C device creation abstractions")
  57c5bd9aee94 ("rust: i2c: add basic I2C device and driver abstractions")

from the driver-core tree.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 rust/kernel/i2c.rs | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs
index 95b056cc1a71..e5e057312858 100644
--- a/rust/kernel/i2c.rs
+++ b/rust/kernel/i2c.rs
@@ -39,16 +39,16 @@
 pub struct DeviceId(bindings::i2c_device_id);
 
 impl DeviceId {
-    const I2C_NAME_SIZE: usize = 20;
+    // const I2C_NAME_SIZE: usize = 20;
 
     /// Create a new device id from an I2C 'id' string.
     #[inline(always)]
     pub const fn new(id: &'static CStr) -> Self {
-        build_assert!(
-            id.len_with_nul() <= Self::I2C_NAME_SIZE,
-            "ID exceeds 20 bytes"
-        );
-        let src = id.as_bytes_with_nul();
+        // build_assert!(
+        //     id.len_with_nul() <= Self::I2C_NAME_SIZE,
+        //     "ID exceeds 20 bytes"
+        // );
+        let src = id.to_bytes_with_nul();
         let mut i2c: bindings::i2c_device_id = pin_init::zeroed();
         let mut i = 0;
         while i < src.len() {
@@ -430,15 +430,15 @@ unsafe fn dec_ref(obj: NonNull<Self>) {
 pub struct I2cBoardInfo(bindings::i2c_board_info);
 
 impl I2cBoardInfo {
-    const I2C_TYPE_SIZE: usize = 20;
+    // const I2C_TYPE_SIZE: usize = 20;
     /// Create a new [`I2cBoardInfo`] for a kernel driver.
     #[inline(always)]
     pub const fn new(type_: &'static CStr, addr: u16) -> Self {
-        build_assert!(
-            type_.len_with_nul() <= Self::I2C_TYPE_SIZE,
-            "Type exceeds 20 bytes"
-        );
-        let src = type_.as_bytes_with_nul();
+        // build_assert!(
+        //     type_.len_with_nul() <= Self::I2C_TYPE_SIZE,
+        //     "Type exceeds 20 bytes"
+        // );
+        let src = type_.to_bytes_with_nul();
         let mut i2c_board_info: bindings::i2c_board_info = pin_init::zeroed();
         let mut i: usize = 0;
         while i < src.len() {
-- 
2.51.1

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2025-11-20  7:11 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20  7:11 Stephen Rothwell [this message]
2025-11-20  9:15 ` linux-next: manual merge of the rust tree with the driver-core tree Miguel Ojeda
2025-11-20 11:27   ` Tamir Duberstein
2025-11-21  4:39     ` Stephen Rothwell
2025-11-21 12:16       ` Tamir Duberstein
2025-11-21 15:56         ` Miguel Ojeda
2025-11-21 16:07           ` Greg KH
2025-11-23 16:39             ` Miguel Ojeda
2025-11-21 19:21           ` Danilo Krummrich
  -- strict thread matches above, loose matches on Subject: below --
2025-11-14  4:18 Stephen Rothwell
2025-12-05  3:23 ` Stephen Rothwell
2025-11-10  1:31 Stephen Rothwell
2025-11-10  1:24 Stephen Rothwell
2025-12-05  3:22 ` Stephen Rothwell
2025-09-23 16:44 Mark Brown
2025-09-23 16:49 ` Danilo Krummrich
2025-09-23 19:24   ` Miguel Ojeda
2025-09-24  8:04     ` Mark Brown
2025-09-24  8:25       ` Miguel Ojeda
2025-09-16 13:27 Mark Brown
2025-07-23  1:26 Stephen Rothwell
2025-07-23 12:49 ` Miguel Ojeda
2025-07-21  4:25 Stephen Rothwell
2025-07-21  8:24 ` Miguel Ojeda
2025-07-18 11:01 Stephen Rothwell
2025-07-18 10:46 Stephen Rothwell
2025-07-18 16:43 ` Danilo Krummrich
2025-07-18 10:26 Stephen Rothwell
2025-07-18 10:47 ` Stephen Rothwell
2025-07-15  8:26 Stephen Rothwell
2025-07-15  8:21 Stephen Rothwell
2025-07-11  8:04 Stephen Rothwell
2025-07-11  9:27 ` Tamir Duberstein
2025-07-11  7:59 Stephen Rothwell
2025-07-11  9:48 ` Miguel Ojeda
2025-07-01  7:46 Stephen Rothwell
2025-07-01  9:12 ` Miguel Ojeda
2025-03-21  7:56 Stephen Rothwell
2025-03-21 20:54 ` Miguel Ojeda
2025-04-01  3:21 ` Stephen Rothwell
2025-04-01  7:42   ` Greg KH
2025-01-14  4:46 Stephen Rothwell
2025-01-14  8:39 ` Miguel Ojeda
2025-01-23  3:30 ` Stephen Rothwell
2025-01-14  4:37 Stephen Rothwell
2025-01-14  8:38 ` Miguel Ojeda
2025-01-23  3:28 ` Stephen Rothwell
2025-01-13  4:12 Stephen Rothwell
2025-01-13 11:13 ` Miguel Ojeda
2025-01-23  3:31 ` Stephen Rothwell
2024-12-17  3:09 Stephen Rothwell
2024-12-17  8:15 ` Greg KH
2024-12-18  0:18 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251120181111.65ce75a0@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=dakr@kernel.org \
    --cc=greg@kroah.com \
    --cc=igor.korotin.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=tamird@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox