-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string::raw::from_buf
and c_char
conflict
#16283
Comments
cc @aturon |
Thanks for the heads up, I'll take care of this. |
Theoretically I believe |
My preference is to make @huonw It's possible the examples I'm running into start from &c_char or something. There are a few examples of this in the latest Rust upgrade: |
@huonw If we tried to match the platform C compilers means then |
It seems that x86_64 compilers like Clang expect a |
c_char not being char will break sign extension in FFI code: void f(int);
int main(void) {
char c = -1;
f(c);
} fn main() {
let c: c_char = -1;
unsafe { f(c as c_int); }
} On the same machine this will do different things if the signedness of c_char and the signedness of char don't match. |
This was resolved in #20507 |
c_char
isi8
, so trying to usestring::raw::from_buf
involves this:Either
c_char
should switch tou8
, orstring::raw::from_buf
should take*const i8
. Right now using this is quite tedious.The text was updated successfully, but these errors were encountered: