-
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.
Adds
--constified-enum-module
option per #699
- Loading branch information
Showing
7 changed files
with
181 additions
and
11 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)] | ||
|
||
|
||
pub mod foo { | ||
pub type Type = ::std::os::raw::c_uint; | ||
pub const THIS: Type = 0; | ||
pub const SHOULD_BE: Type = 1; | ||
pub const A_CONSTANT: Type = 2; | ||
} | ||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct bar { | ||
pub this_should_work: foo::Type, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_bar() { | ||
assert_eq!(::std::mem::size_of::<bar>() , 4usize , concat ! ( | ||
"Size of: " , stringify ! ( bar ) )); | ||
assert_eq! (::std::mem::align_of::<bar>() , 4usize , concat ! ( | ||
"Alignment of " , stringify ! ( bar ) )); | ||
assert_eq! (unsafe { | ||
& ( * ( 0 as * const bar ) ) . this_should_work as * const _ | ||
as usize } , 0usize , concat ! ( | ||
"Alignment of field: " , stringify ! ( bar ) , "::" , | ||
stringify ! ( this_should_work ) )); | ||
} | ||
impl Clone for bar { | ||
fn clone(&self) -> Self { *self } | ||
} | ||
impl Default for bar { | ||
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,11 @@ | ||
// bindgen-flags: --constified-enum-module foo | ||
|
||
enum foo { | ||
THIS, | ||
SHOULD_BE, | ||
A_CONSTANT, | ||
}; | ||
|
||
struct bar { | ||
enum foo this_should_work; | ||
}; |