Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#90421 - thomcc:friendship-ended-with-ssize_t-…
…now-ptrdiff_t-is-my-best-friend, r=joshtriplett Replace `std::os::raw::c_ssize_t` with `std::os::raw::c_ptrdiff_t` The discussions in rust-lang#88345 brought up that `ssize_t` is not actually the signed index type defined in stddef.h, but instead it's `ptrdiff_t`. It seems pretty clear that the use of `ssize_t` here was a mistake on my part, and that if we're going to bother having a isize-alike for FFI in `std::os::raw`, it should be `ptrdiff_t` and not `ssize_t`. Anyway, both this and `c_size_t` are dubious in the face of the discussion in https://internals.rust-lang.org/t/pre-rfc-usize-is-not-size-t/15369, and any RFC/project-group/etc that handles those issues there should contend with these types in some manner, but that doesn't mean we shouldn't fix something wrong like this, even if it is unstable. All that said, `size_t` is *vastly* more common in function signatures than either `ssize_t` or `ptrdiff_t`, so I'm going to update the tracking issue's list of unresolved questions to note that perhaps we only want `c_size_t` — I mostly added the signed version for symmetry, rather than to meet a need. (Given this, I'm also fine with modifying this patch to instead remove `c_ssize_t` without a replacement) CC `@magicant` (who brought the issue up) CC `@chorman0773` (who has a significantly firmer grasp on the minutae of the C standard than I do) r? `@joshtriplett` (original reviewer, active in the discussions around this)
- Loading branch information