Rust for Linux List
 help / color / mirror / Atom feed
* FTBFS: Rust firmware abstractions in current stable (6.13.4) on arm64 with rustc 1.85.0
@ 2025-02-22 12:09 NoisyCoil
  2025-02-22 12:20 ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: NoisyCoil @ 2025-02-22 12:09 UTC (permalink / raw)
  To: stable; +Cc: regressions, ojeda, alex.gaynor, linux-kernel, rust-for-linux

Hi!

The Rust firmware abstractions FTBFS on arm64 and current stable 
(6.13.4) when compiled with rustc 1.85.0:


```
   RUSTC L rust/kernel.o
error[E0308]: mismatched types
   --> rust/kernel/firmware.rs:20:14
    |
20 |         Self(bindings::request_firmware)
    |         ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found 
fn item
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, *const i8, _) -> _`
                  found fn item `unsafe extern "C" fn(_, *const u8, _) 
-> _ {request_firmware}`
note: tuple struct defined here
   --> rust/kernel/firmware.rs:14:8
    |
14 | struct FwFunc(
    |        ^^^^^^

error[E0308]: mismatched types
   --> rust/kernel/firmware.rs:24:14
    |
24 |         Self(bindings::firmware_request_nowarn)
    |         ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn 
pointer, found fn item
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, *const i8, _) -> _`
                  found fn item `unsafe extern "C" fn(_, *const u8, _) 
-> _ {firmware_request_nowarn}`
note: tuple struct defined here
   --> rust/kernel/firmware.rs:14:8
    |
14 | struct FwFunc(
    |        ^^^^^^

error[E0308]: mismatched types
   --> rust/kernel/firmware.rs:64:45
    |
64 |         let ret = unsafe { func.0(pfw as _, name.as_char_ptr(), 
dev.as_raw()) };
    |                            ------           ^^^^^^^^^^^^^^^^^^ 
expected `*const i8`, found `*const u8`
    |                            |
    |                            arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error: aborting due to 3 previous errors

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


This is because rustc 1.85 (now stable) switched core::ffi::c_char from 
i8 to u8 on arm64 and other platforms [1], and because current stable 
still uses rustc's core's instead of the custom ffi integer types like 
6.14 will. Looking for other i8's in *.rs files tells me only the QR 
code panic screen should be affected in addition to the firmware 
abstractions, and that was already reported in [2].

A simple fix would be to switch i8 to u8 in `struct FwFunc`, but that 
breaks rustc <= 1.84 so I guess a more robust solution is needed.

Cheers!


[1] https://github.com/rust-lang/rust/pull/132975
[2] 
https://lore.kernel.org/all/20250120124531.2581448-1-linkmauve@linkmauve.fr/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FTBFS: Rust firmware abstractions in current stable (6.13.4) on arm64 with rustc 1.85.0
  2025-02-22 12:09 FTBFS: Rust firmware abstractions in current stable (6.13.4) on arm64 with rustc 1.85.0 NoisyCoil
@ 2025-02-22 12:20 ` Miguel Ojeda
  2025-02-22 15:14   ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Ojeda @ 2025-02-22 12:20 UTC (permalink / raw)
  To: NoisyCoil, Danilo Krummrich
  Cc: stable, regressions, ojeda, alex.gaynor, linux-kernel,
	rust-for-linux

On Sat, Feb 22, 2025 at 1:09 PM NoisyCoil <noisycoil@disroot.org> wrote:
>
> The Rust firmware abstractions FTBFS on arm64 and current stable
> (6.13.4) when compiled with rustc 1.85.0:

Thanks for the report! Yeah, I noticed in my builds too but didn't get
to it yet (there are also a couple Clippy warnings in the QR code too,
in case you see them).

Cc'ing Danilo in case he wants to send the fix, otherwise I will.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FTBFS: Rust firmware abstractions in current stable (6.13.4) on arm64 with rustc 1.85.0
  2025-02-22 12:20 ` Miguel Ojeda
@ 2025-02-22 15:14   ` Miguel Ojeda
  0 siblings, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-02-22 15:14 UTC (permalink / raw)
  To: NoisyCoil, Danilo Krummrich
  Cc: stable, regressions, ojeda, alex.gaynor, linux-kernel,
	rust-for-linux

On Sat, Feb 22, 2025 at 1:20 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Thanks for the report! Yeah, I noticed in my builds too but didn't get
> to it yet (there are also a couple Clippy warnings in the QR code too,
> in case you see them).
>
> Cc'ing Danilo in case he wants to send the fix, otherwise I will.

s/fix/backport -- actually, sorry, I just sent it.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-22 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-22 12:09 FTBFS: Rust firmware abstractions in current stable (6.13.4) on arm64 with rustc 1.85.0 NoisyCoil
2025-02-22 12:20 ` Miguel Ojeda
2025-02-22 15:14   ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox