File tree Expand file tree Collapse file tree 5 files changed +47
-6
lines changed Expand file tree Collapse file tree 5 files changed +47
-6
lines changed Original file line number Diff line number Diff line change @@ -1598,7 +1598,7 @@ impl CodeGenerator for CompInfo {
1598
1598
}
1599
1599
}
1600
1600
1601
- if ctx. options ( ) . codegen_config . destructor {
1601
+ if ctx. options ( ) . codegen_config . destructors {
1602
1602
if let Some ( ( is_virtual, destructor) ) = self . destructor ( ) {
1603
1603
let kind = if is_virtual {
1604
1604
MethodKind :: VirtualDestructor
Original file line number Diff line number Diff line change @@ -109,8 +109,8 @@ pub struct CodegenConfig {
109
109
pub methods : bool ,
110
110
/// Whether to generate constructors.
111
111
pub constructors : bool ,
112
- /// Whether to generate a destructor .
113
- pub destructor : bool ,
112
+ /// Whether to generate destructors .
113
+ pub destructors : bool ,
114
114
}
115
115
116
116
impl CodegenConfig {
@@ -122,7 +122,7 @@ impl CodegenConfig {
122
122
vars : true ,
123
123
methods : true ,
124
124
constructors : true ,
125
- destructor : true ,
125
+ destructors : true ,
126
126
}
127
127
}
128
128
@@ -134,7 +134,7 @@ impl CodegenConfig {
134
134
vars : false ,
135
135
methods : false ,
136
136
constructors : false ,
137
- destructor : false ,
137
+ destructors : false ,
138
138
}
139
139
}
140
140
}
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ pub fn builder_from_flags<I>
112
112
. long ( "generate" )
113
113
. help ( "Generate a given kind of items, split by commas. \
114
114
Valid values are \" functions\" ,\" types\" , \" vars\" , \
115
- \" methods\" and \" constructors \" .")
115
+ \" methods\" , \" constructors \" and \" destructors \" .")
116
116
. takes_value ( true ) ,
117
117
Arg :: with_name ( "ignore-methods" )
118
118
. long ( "ignore-methods" )
@@ -272,6 +272,7 @@ pub fn builder_from_flags<I>
272
272
"vars" => config. vars = true ,
273
273
"methods" => config. methods = true ,
274
274
"constructors" => config. constructors = true ,
275
+ "destructors" => config. destructors = true ,
275
276
_ => {
276
277
return Err ( Error :: new ( ErrorKind :: Other ,
277
278
"Unknown generate item" ) ) ;
Original file line number Diff line number Diff line change
1
+ /* automatically generated by rust-bindgen */
2
+
3
+
4
+ #![ allow( non_snake_case) ]
5
+
6
+
7
+ #[ repr( C ) ]
8
+ #[ derive( Debug , Default ) ]
9
+ pub struct Foo {
10
+ pub bar : :: std:: os:: raw:: c_int ,
11
+ }
12
+ #[ test]
13
+ fn bindgen_test_layout_Foo ( ) {
14
+ assert_eq ! ( :: std:: mem:: size_of:: <Foo >( ) , 4usize , concat ! (
15
+ "Size of: " , stringify ! ( Foo ) ) ) ;
16
+ assert_eq ! ( :: std:: mem:: align_of:: <Foo >( ) , 4usize , concat ! (
17
+ "Alignment of " , stringify ! ( Foo ) ) ) ;
18
+ assert_eq ! ( unsafe {
19
+ & ( * ( 0 as * const Foo ) ) . bar as * const _ as usize } ,
20
+ 0usize , concat ! (
21
+ "Alignment of field: " , stringify ! ( Foo ) , "::" ,
22
+ stringify ! ( bar ) ) ) ;
23
+ }
24
+ extern "C" {
25
+ #[ link_name = "_ZN3FooD1Ev" ]
26
+ pub fn Foo_Foo_destructor ( this : * mut Foo ) ;
27
+ }
28
+ impl Foo {
29
+ #[ inline]
30
+ pub unsafe fn __bindgen_destructor__ ( & mut self ) {
31
+ Foo_Foo_destructor ( & mut * self )
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ // bindgen-flags: --generate types,destructors,functions
2
+
3
+ class Foo {
4
+ int bar;
5
+ public:
6
+ ~Foo ();
7
+ };
You can’t perform that action at this time.
0 commit comments