Skip to content

Commit a2c078d

Browse files
committed
zephyr: printk: Use proper type for c_char
Rust 1.85 changes the type of `c_char` in `core::ffi` to better match C. This causes our explicit cast when calling `k_str_out` to break on some platforms. Fix this by casting to `c_char` which should always match the type. Signed-off-by: David Brown <[email protected]>
1 parent ac164c3 commit a2c078d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

zephyr/src/printk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! This uses the `k_str_out` syscall, which is part of printk to output to the console.
77
8-
use core::fmt::{write, Arguments, Result, Write};
8+
use core::{ffi::c_char, fmt::{write, Arguments, Result, Write}};
99

1010
/// Print to Zephyr's console, without a newline.
1111
///
@@ -92,7 +92,7 @@ impl Context {
9292
fn flush(&mut self) {
9393
if self.count > 0 {
9494
unsafe {
95-
zephyr_sys::k_str_out(self.buf.as_mut_ptr() as *mut i8, self.count);
95+
zephyr_sys::k_str_out(self.buf.as_mut_ptr() as *mut c_char, self.count);
9696
}
9797
self.count = 0;
9898
}

0 commit comments

Comments
 (0)