Skip to content

Commit 5d38f2a

Browse files
cmcavityemilio
authored andcommitted
Remove size_t to usize conversion rule
1 parent b3c3980 commit 5d38f2a

9 files changed

+23
-10
lines changed

src/codegen/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4092,9 +4092,9 @@ mod utils {
40924092
"int64_t" => primitive_ty(ctx, "i64"),
40934093
"uint64_t" => primitive_ty(ctx, "u64"),
40944094

4095-
"uintptr_t" | "size_t" => primitive_ty(ctx, "usize"),
4095+
"uintptr_t" => primitive_ty(ctx, "usize"),
40964096

4097-
"intptr_t" | "ptrdiff_t" | "ssize_t" => primitive_ty(ctx, "isize"),
4097+
"intptr_t" | "ptrdiff_t" => primitive_ty(ctx, "isize"),
40984098
_ => return None,
40994099
})
41004100
}

tests/expectations/tests/blocks-signature.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#![cfg(target_os = "macos")]
1010

1111
extern crate block;
12+
pub type size_t = ::std::os::raw::c_ulonglong;
1213
extern "C" {
1314
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
1415
pub fn atexit_b(arg1: _bindgen_ty_id_33);
@@ -82,11 +83,16 @@ impl Default for contains_block_pointers {
8283
}
8384
pub type _bindgen_ty_id_33 = *const ::block::Block<(), ()>;
8485
pub type _bindgen_ty_id_40 = *const ::block::Block<
85-
(dispatch_data_t, usize, *const ::std::os::raw::c_void, usize),
86+
(
87+
dispatch_data_t,
88+
size_t,
89+
*const ::std::os::raw::c_void,
90+
size_t,
91+
),
8692
bool,
8793
>;
88-
pub type _bindgen_ty_id_50 = *const ::block::Block<(usize,), ()>;
89-
pub type _bindgen_ty_id_56 = *const ::block::Block<(usize,), ()>;
94+
pub type _bindgen_ty_id_50 = *const ::block::Block<(size_t,), ()>;
95+
pub type _bindgen_ty_id_56 = *const ::block::Block<(size_t,), ()>;
9096
pub type contains_block_pointers__bindgen_ty_id_61 =
9197
*const ::block::Block<(::std::os::raw::c_int,), ()>;
9298
pub type _bindgen_ty_id_68 =

tests/expectations/tests/blocks.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
)]
99
#![cfg(target_os = "macos")]
1010

11+
pub type size_t = ::std::os::raw::c_ulonglong;
1112
extern "C" {
1213
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
1314
pub fn atexit_b(arg1: *mut ::std::os::raw::c_void);

tests/expectations/tests/issue-1498.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
non_upper_case_globals
88
)]
99

10+
pub type size_t = u64;
1011
#[repr(C, packed)]
1112
#[derive(Copy, Clone)]
1213
pub struct rte_memseg {
1314
///< Start physical address.
1415
pub phys_addr: u64,
1516
pub __bindgen_anon_1: rte_memseg__bindgen_ty_1,
1617
///< Length of the segment.
17-
pub len: usize,
18+
pub len: size_t,
1819
///< The pagesize of underlying memory
1920
pub hugepage_sz: u64,
2021
///< NUMA socket ID.

tests/expectations/tests/jsval_layout_opaque.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ where
9797
pub const JSVAL_TAG_SHIFT: u32 = 47;
9898
pub const JSVAL_PAYLOAD_MASK: u64 = 140737488355327;
9999
pub const JSVAL_TAG_MASK: i64 = -140737488355328;
100+
pub type size_t = ::std::os::raw::c_ulonglong;
100101
#[repr(u8)]
101102
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
102103
pub enum JSValueType {
@@ -188,7 +189,7 @@ pub union jsval_layout {
188189
pub s: jsval_layout__bindgen_ty_2,
189190
pub asDouble: f64,
190191
pub asPtr: *mut ::std::os::raw::c_void,
191-
pub asWord: usize,
192+
pub asWord: size_t,
192193
pub asUIntPtr: usize,
193194
_bindgen_union_align: u64,
194195
}

tests/expectations/tests/jsval_layout_opaque_1_0.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ impl<T> ::std::cmp::Eq for __BindgenUnionField<T> {}
140140
pub const JSVAL_TAG_SHIFT: u32 = 47;
141141
pub const JSVAL_PAYLOAD_MASK: u64 = 140737488355327;
142142
pub const JSVAL_TAG_MASK: i64 = -140737488355328;
143+
pub type size_t = ::std::os::raw::c_ulonglong;
143144
#[repr(u8)]
144145
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
145146
pub enum JSValueType {
@@ -231,7 +232,7 @@ pub struct jsval_layout {
231232
pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>,
232233
pub asDouble: __BindgenUnionField<f64>,
233234
pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
234-
pub asWord: __BindgenUnionField<usize>,
235+
pub asWord: __BindgenUnionField<size_t>,
235236
pub asUIntPtr: __BindgenUnionField<usize>,
236237
pub bindgen_union_field: u64,
237238
}

tests/expectations/tests/layout_array.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub const RTE_CACHE_LINE_SIZE: u32 = 64;
1111
pub const RTE_MEMPOOL_OPS_NAMESIZE: u32 = 32;
1212
pub const RTE_MEMPOOL_MAX_OPS_IDX: u32 = 16;
1313
pub const RTE_HEAP_NUM_FREELISTS: u32 = 13;
14+
pub type size_t = ::std::os::raw::c_longlong;
1415
#[repr(C)]
1516
#[derive(Debug, Copy, Clone)]
1617
pub struct rte_mempool {
@@ -292,7 +293,7 @@ pub struct malloc_heap {
292293
pub lock: rte_spinlock_t,
293294
pub free_head: [malloc_heap__bindgen_ty_1; 13usize],
294295
pub alloc_count: ::std::os::raw::c_uint,
295-
pub total_size: usize,
296+
pub total_size: size_t,
296297
}
297298
#[repr(C)]
298299
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]

tests/expectations/tests/msvc-no-usr.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
non_upper_case_globals
88
)]
99

10+
pub type size_t = ::std::os::raw::c_ulonglong;
1011
#[repr(C)]
1112
#[derive(Debug, Default, Copy, Clone)]
1213
pub struct A {
13-
pub foo: usize,
14+
pub foo: size_t,
1415
}
1516
#[test]
1617
fn bindgen_test_layout_A() {

tests/expectations/tests/nsBaseHashtable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
non_upper_case_globals
88
)]
99

10+
pub type size_t = ::std::os::raw::c_ulonglong;
1011
#[repr(C)]
1112
#[derive(Debug, Default, Copy, Clone)]
1213
pub struct nsBaseHashtableET {

0 commit comments

Comments
 (0)