You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to be able to compile the above code, but the compiler had a different opinion:
error[E0308]: mismatched types
--> src/logging.rs:90:27
|
90 | unsafe{ libc::printf(c"%s".as_ptr(), line.as_ptr())};
| ------------ ^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: function defined here
--> index.crates.io-6f17d22bba15001f/libc-0.2.169/src/unix/mod.rs:694:12
It would seem that the latest libc 0.2.169 flipped its signedness of c_char from signed to unsigned for ESP-IDF: rust-lang/libc@c66faeb
Sorry, this got lost in my notifications over the holidays. We fixed this in rust-lang/libc#4195 and I believe libc has had a release since then, so this should be fixed. Please re open if that's not the case.
Sorry, this got lost in my notifications over the holidays. We fixed this in rust-lang/libc#4195 and I believe libc has had a release since then, so this should be fixed. Please re open if that's not the case.
Ok, looks like the rustc side will match once 1.85 is out. I'm going to test it then.
I tried this code:
I expected to be able to compile the above code, but the compiler had a different opinion:
It would seem that the latest libc 0.2.169 flipped its signedness of c_char from signed to unsigned for ESP-IDF:
rust-lang/libc@c66faeb
rustc should probably match this signedness change on ESP-IDF and update the definition somewhere around here: https://doc.rust-lang.org/beta/src/core/ffi/mod.rs.html#52
Doing a bit of searching around, I am about 80% sure that char is unsigned on the C side on ESP-IDF.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: