-
Notifications
You must be signed in to change notification settings - Fork 707
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 #1075 - pepyakin:fix-1034, r=fitzgen
Use `repr(packed)` If struct requires explicit alignment of 1. Fixes #1034
- Loading branch information
Showing
8 changed files
with
149 additions
and
112 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
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,35 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] | ||
|
||
|
||
#[repr(C, packed)] | ||
#[derive(Debug, Default, Copy)] | ||
pub struct S2 { | ||
pub _bitfield_1: u16, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_S2() { | ||
assert_eq!( | ||
::std::mem::size_of::<S2>(), | ||
2usize, | ||
concat!("Size of: ", stringify!(S2)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<S2>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(S2)) | ||
); | ||
} | ||
impl Clone for S2 { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} | ||
impl S2 { | ||
#[inline] | ||
pub fn new_bitfield_1() -> u16 { | ||
0 | ||
} | ||
} |
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,4 @@ | ||
|
||
struct S2 { | ||
unsigned : 11 | ||
}; |