-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When the no-partialeq type is transitively referenced by a whitelisted item. When the no-partialeq type is explicitly whitelisted. When the no-partialeq type is marked opaque.
- Loading branch information
Showing
6 changed files
with
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy, PartialEq)] | ||
pub struct NoPartialEq { | ||
pub _bindgen_opaque_blob: u32, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_NoPartialEq() { | ||
assert_eq!( | ||
::std::mem::size_of::<NoPartialEq>(), | ||
4usize, | ||
concat!("Size of: ", stringify!(NoPartialEq)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<NoPartialEq>(), | ||
4usize, | ||
concat!("Alignment of ", stringify!(NoPartialEq)) | ||
); | ||
} | ||
impl Clone for NoPartialEq { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} |
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,35 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy, PartialEq)] | ||
pub struct NoPartialEq { | ||
pub i: ::std::os::raw::c_int, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_NoPartialEq() { | ||
assert_eq!( | ||
::std::mem::size_of::<NoPartialEq>(), | ||
4usize, | ||
concat!("Size of: ", stringify!(NoPartialEq)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<NoPartialEq>(), | ||
4usize, | ||
concat!("Alignment of ", stringify!(NoPartialEq)) | ||
); | ||
assert_eq!( | ||
unsafe { &(*(0 as *const NoPartialEq)).i as *const _ as usize }, | ||
0usize, | ||
concat!( | ||
"Alignment of field: ", | ||
stringify!(NoPartialEq), | ||
"::", | ||
stringify!(i) | ||
) | ||
); | ||
} | ||
impl Clone for NoPartialEq { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/expectations/tests/whitelisted-item-references-no-partialeq.rs
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,58 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct NoPartialEq { | ||
pub _address: u8, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_NoPartialEq() { | ||
assert_eq!( | ||
::std::mem::size_of::<NoPartialEq>(), | ||
1usize, | ||
concat!("Size of: ", stringify!(NoPartialEq)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<NoPartialEq>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(NoPartialEq)) | ||
); | ||
} | ||
impl Clone for NoPartialEq { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} | ||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct WhitelistMe { | ||
pub a: NoPartialEq, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_WhitelistMe() { | ||
assert_eq!( | ||
::std::mem::size_of::<WhitelistMe>(), | ||
1usize, | ||
concat!("Size of: ", stringify!(WhitelistMe)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<WhitelistMe>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(WhitelistMe)) | ||
); | ||
assert_eq!( | ||
unsafe { &(*(0 as *const WhitelistMe)).a as *const _ as usize }, | ||
0usize, | ||
concat!( | ||
"Alignment of field: ", | ||
stringify!(WhitelistMe), | ||
"::", | ||
stringify!(a) | ||
) | ||
); | ||
} | ||
impl Clone for WhitelistMe { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} |
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,5 @@ | ||
// bindgen-flags --with-derive-partialeq --opaque-type "NoPartialEq" --no-partialeq "NoPartialEq" | ||
|
||
class NoPartialEq { | ||
int i; | ||
}; |
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,5 @@ | ||
// bindgen-flags: --with-derive-partialeq --whitelist-type "NoPartialEq" --no-partialeq "NoPartialEq" | ||
|
||
class NoPartialEq { | ||
int i; | ||
}; |
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,7 @@ | ||
// bindgen-flags: --with-derive-partialeq --whitelist-type "WhitelistMe" --no-partialeq "NoPartialEq" | ||
|
||
struct NoPartialEq {}; | ||
|
||
class WhitelistMe { | ||
NoPartialEq a; | ||
}; |