-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
options: Add an opt-in to recover the size_t behavior removed in 5d38f2a
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
#![allow( | ||
dead_code, | ||
non_snake_case, | ||
non_camel_case_types, | ||
non_upper_case_globals | ||
)] | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy, Clone)] | ||
pub struct A { | ||
pub len: usize, | ||
pub offset: isize, | ||
pub next: *mut A, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_A() { | ||
assert_eq!( | ||
::std::mem::size_of::<A>(), | ||
24usize, | ||
concat!("Size of: ", stringify!(A)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<A>(), | ||
8usize, | ||
concat!("Alignment of ", stringify!(A)) | ||
); | ||
assert_eq!( | ||
unsafe { &(*(::std::ptr::null::<A>())).len as *const _ as usize }, | ||
0usize, | ||
concat!("Offset of field: ", stringify!(A), "::", stringify!(len)) | ||
); | ||
assert_eq!( | ||
unsafe { &(*(::std::ptr::null::<A>())).offset as *const _ as usize }, | ||
8usize, | ||
concat!("Offset of field: ", stringify!(A), "::", stringify!(offset)) | ||
); | ||
assert_eq!( | ||
unsafe { &(*(::std::ptr::null::<A>())).next as *const _ as usize }, | ||
16usize, | ||
concat!("Offset of field: ", stringify!(A), "::", stringify!(next)) | ||
); | ||
} | ||
impl Default for A { | ||
fn default() -> Self { | ||
unsafe { ::std::mem::zeroed() } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// bindgen-flags: --size_t-is-usize | ||
|
||
typedef unsigned long size_t; | ||
typedef long ssize_t; | ||
|
||
struct A { | ||
size_t len; | ||
ssize_t offset; | ||
struct A* next; | ||
}; |