linux-next: build failure after merge of the rust tree
From: Stephen Rothwell
Date: Mon Nov 11 2024 - 01:58:56 EST
Hi all,
My first rust build error! ;-)
After merging the rust tree, today's linux-next build (x86_64
allmodconfig) failed like this:
error[E0308]: mismatched types
--> rust/kernel/device.rs:176:17
|
175 | bindings::_dev_printk(
| --------------------- arguments to this function are incorrect
176 | klevel as *const _ as *const core::ffi::c_char,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
|
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: function defined here
--> /home/sfr/next/x86_64_allmodconfig/rust/bindings/bindings_generated.rs:60521:12
|
60521 | pub fn _dev_printk(level: *const ffi::c_char, dev: *const device, fmt: *const ffi::c_char, ...);
| ^^^^^^^^^^^
error[E0308]: mismatched types
--> rust/kernel/miscdevice.rs:159:52
|
159 | unlocked_ioctl: maybe_fn(T::HAS_IOCTL, fops_ioctl::<T>),
| -------- ^^^^^^^^^^^^^^^ expected fn pointer, found fn item
| |
| arguments to this function are incorrect
|
= note: expected fn pointer `unsafe extern "C" fn(_, _, usize) -> isize`
found fn item `unsafe extern "C" fn(_, _, u64) -> i64 {fops_ioctl::<T>}`
help: the return type of this call is `unsafe extern "C" fn(*mut bindings::file, u32, u64) -> i64 {fops_ioctl::<T>}` due to the type of the argument passed
--> rust/kernel/miscdevice.rs:159:29
|
159 | unlocked_ioctl: maybe_fn(T::HAS_IOCTL, fops_ioctl::<T>),
| ^^^^^^^^^^^^^^^^^^^^^^^---------------^
| |
| this argument influences the return type of `maybe_fn`
note: function defined here
--> rust/kernel/miscdevice.rs:144:14
|
144 | const fn maybe_fn<T: Copy>(check: bool, func: T) -> Option<T> {
| ^^^^^^^^ -------
error[E0308]: mismatched types
--> rust/kernel/miscdevice.rs:162:22
|
162 | Some(fops_compat_ioctl::<T>)
| ---- ^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
| |
| arguments to this enum variant are incorrect
|
= note: expected fn pointer `unsafe extern "C" fn(_, _, usize) -> isize`
found fn item `unsafe extern "C" fn(_, _, u64) -> i64 {fops_compat_ioctl::<T>}`
help: the type constructed contains `unsafe extern "C" fn(*mut bindings::file, u32, u64) -> i64 {fops_compat_ioctl::<T>}` due to the type of the argument passed
--> rust/kernel/miscdevice.rs:162:17
|
162 | Some(fops_compat_ioctl::<T>)
| ^^^^^----------------------^
| |
| this argument influences the type of `Some`
note: tuple variant defined here
--> /usr/lib/rustlib/src/rust/library/core/src/option.rs:579:5
|
579 | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ^^^^
error[E0308]: mismatched types
--> rust/kernel/security.rs:36:13
|
32 | to_result(unsafe { bindings::security_secid_to_secctx(secid, &mut secdata, &mut seclen) })?;
| ------- here the type of `secdata` is inferred to be `*mut u8`
...
36 | secdata,
| ^^^^^^^ expected `*mut i8`, found `*mut u8`
|
= note: expected raw pointer `*mut i8`
found raw pointer `*mut u8`
error[E0308]: mismatched types
--> rust/kernel/security.rs:72:52
|
72 | unsafe { bindings::security_release_secctx(self.secdata, self.seclen as u32) };
| --------------------------------- ^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*mut u8`
found raw pointer `*mut i8`
note: function defined here
--> /home/sfr/next/x86_64_allmodconfig/rust/bindings/bindings_generated.rs:87586:12
|
87586 | pub fn security_release_secctx(secdata: *mut ffi::c_char, seclen: u32_);
| ^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0308`.
Presumably caused by my merge resolutions involving commit
d072acda4862 ("rust: use custom FFI integer types")
I have used the rust tree from next-20241108 for today.
Any help with the merge resolutions would be much appreciated.
--
Cheers,
Stephen Rothwell
Attachment:
pgp3aPuAxwIl3.pgp
Description: OpenPGP digital signature