File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1612,14 +1612,20 @@ impl CodeGenerator for CompInfo {
1612
1612
) ;
1613
1613
}
1614
1614
1615
- if is_union && ! self . can_be_rust_union ( ctx ) {
1615
+ if is_union {
1616
1616
let layout = layout. expect ( "Unable to get layout information?" ) ;
1617
1617
let ty = BlobTyBuilder :: new ( layout) . build ( ) ;
1618
- let field = StructFieldBuilder :: named ( "bindgen_union_field" )
1619
- . pub_ ( )
1620
- . build_ty ( ty) ;
1618
+
1619
+ let field = if self . can_be_rust_union ( ctx) {
1620
+ StructFieldBuilder :: named ( "_bindgen_union_align" )
1621
+ . build_ty ( ty)
1622
+ } else {
1623
+ struct_layout. saw_union ( layout) ;
1621
1624
1622
- struct_layout. saw_union ( layout) ;
1625
+ StructFieldBuilder :: named ( "bindgen_union_field" )
1626
+ . pub_ ( )
1627
+ . build_ty ( ty)
1628
+ } ;
1623
1629
1624
1630
fields. push ( field) ;
1625
1631
}
You can’t perform that action at this time.
0 commit comments