Skip to content

Commit 37dc7fa

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 9714921 commit 37dc7fa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

zephyr/src/printk.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
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::{
9+
ffi::c_char,
10+
fmt::{write, Arguments, Result, Write},
11+
};
912

1013
/// Print to Zephyr's console, without a newline.
1114
///
@@ -92,7 +95,7 @@ impl Context {
9295
fn flush(&mut self) {
9396
if self.count > 0 {
9497
unsafe {
95-
zephyr_sys::k_str_out(self.buf.as_mut_ptr() as *mut i8, self.count);
98+
zephyr_sys::k_str_out(self.buf.as_mut_ptr() as *mut c_char, self.count);
9699
}
97100
self.count = 0;
98101
}

0 commit comments

Comments
 (0)