-
Notifications
You must be signed in to change notification settings - Fork 761
Closed
Description
Input C/C++ Header
#include <stddef.h>
static size_t A = 5;
bindgen converts size_t
to `usize. but I'm not sure that's correct. the unsafe guidelines(https://rust-lang.github.io/unsafe-code-guidelines/layout/scalars.html) say that usize==uintptr_t. but the C standard doesn't define that uintptr_t==size_t therefore usize != size_t.
Am I missing something?
ahlinc
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
highfive commentedon Nov 9, 2019
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the
#servo
channel in IRC.If you intend to work on this issue, then add
@highfive: assign me
to your comment, and I'll assign this to you. 😄emilio commentedon Nov 9, 2019
You're technically correct, I think (which is the best kind of correct ;)).
In practice, in all platforms that I know of
sizeof(size_t) == sizeof(uintptr_t)
. See https://stackoverflow.com/questions/1464174/size-t-vs-uintptr-t.But we should probably avoid doing this transformation, should be straight-forward.
cmcavity commentedon Nov 13, 2019
Hi I'd like to work on this. Should the
ssize_t
toisize
transformation be removed as well?@highfive: assign me
highfive commentedon Nov 13, 2019
Hey @cmcavity! Thanks for your interest in working on this issue. It's now assigned to you!
cmcavity commentedon Jan 22, 2020
@emilio This issue should be closed after pull request #1688.
emilio commentedon Feb 2, 2020
Fixed by the above PR.
quidity commentedon Feb 5, 2020
For posterity, a flag was added to revert to previous behavior: --size_t-is-usize
f96dcf9
29 remaining items
rust/arm 32-bit: remove guard for rust-bindgen bug
rust: helpers: remove guard for rust-bindgen bug
Map size_t to usize by default and check compatibility (fixes rust-la…
#![feature(c_size_t)]
(std::os::raw::c_size_t
/std::os::raw::c_ssize_t
) rust-lang/rust#88345Map size_t to usize by default and check compatibility (fixes rust-la…
Map size_t to usize by default and check compatibility (fixes rust-la…
Map size_t to usize by default and check compatibility (fixes rust-la…
Unpin bindgen and use `--size_t-is-usize`