File tree 4 files changed +37
-13
lines changed
4 files changed +37
-13
lines changed Original file line number Diff line number Diff line change @@ -1473,8 +1473,25 @@ impl DotAttributes for CompInfo {
1473
1473
impl IsOpaque for CompInfo {
1474
1474
type Extra = ( ) ;
1475
1475
1476
- fn is_opaque ( & self , _: & BindgenContext , _: & ( ) ) -> bool {
1477
- self . has_non_type_template_params
1476
+ fn is_opaque ( & self , ctx : & BindgenContext , _: & ( ) ) -> bool {
1477
+ // Early return to avoid extra computation
1478
+ if self . has_non_type_template_params {
1479
+ return true
1480
+ }
1481
+
1482
+ self . fields ( ) . iter ( ) . any ( |f| match * f {
1483
+ Field :: DataMember ( _) => {
1484
+ false
1485
+ } ,
1486
+ Field :: Bitfields ( ref unit) => {
1487
+ unit. bitfields ( ) . iter ( ) . any ( |bf| {
1488
+ let bitfield_layout = ctx. resolve_type ( bf. ty ( ) )
1489
+ . layout ( ctx)
1490
+ . expect ( "Bitfield without layout? Gah!" ) ;
1491
+ bf. width ( ) / 8 > bitfield_layout. size as u32
1492
+ } )
1493
+ }
1494
+ } )
1478
1495
}
1479
1496
}
1480
1497
Original file line number Diff line number Diff line change @@ -1137,8 +1137,6 @@ impl BindgenContext {
1137
1137
{
1138
1138
self . in_codegen = true ;
1139
1139
1140
- self . assert_no_dangling_references ( ) ;
1141
-
1142
1140
if !self . collected_typerefs ( ) {
1143
1141
self . resolve_typerefs ( ) ;
1144
1142
self . compute_bitfield_units ( ) ;
@@ -1147,8 +1145,6 @@ impl BindgenContext {
1147
1145
1148
1146
self . deanonymize_fields ( ) ;
1149
1147
1150
- // And assert once again, because resolving type refs and processing
1151
- // replacements both mutate the IR graph.
1152
1148
self . assert_no_dangling_references ( ) ;
1153
1149
1154
1150
// Compute the whitelisted set after processing replacements and
Original file line number Diff line number Diff line change 5
5
6
6
7
7
#[ repr( C ) ]
8
+ #[ derive( Debug , Default , Copy ) ]
8
9
pub struct _bindgen_ty_1 {
9
- pub _bitfield_1 : [ u8 ; 128usize ] ,
10
- pub __bindgen_align : [ u64 ; 0usize ] ,
10
+ pub _bindgen_opaque_blob : [ u64 ; 10usize ] ,
11
11
}
12
- impl Default for _bindgen_ty_1 {
13
- fn default ( ) -> Self {
14
- unsafe { :: std:: mem:: zeroed ( ) }
12
+ #[ test]
13
+ fn bindgen_test_layout__bindgen_ty_1 ( ) {
14
+ assert_eq ! (
15
+ :: std:: mem:: size_of:: <_bindgen_ty_1>( ) ,
16
+ 80usize ,
17
+ concat!( "Size of: " , stringify!( _bindgen_ty_1) )
18
+ ) ;
19
+ assert_eq ! (
20
+ :: std:: mem:: align_of:: <_bindgen_ty_1>( ) ,
21
+ 8usize ,
22
+ concat!( "Alignment of " , stringify!( _bindgen_ty_1) )
23
+ ) ;
24
+ }
25
+ impl Clone for _bindgen_ty_1 {
26
+ fn clone ( & self ) -> Self {
27
+ * self
15
28
}
16
29
}
17
30
extern "C" {
Original file line number Diff line number Diff line change 1
- // bindgen-flags: --no-layout-tests
2
-
3
1
struct {
4
2
unsigned : 632 ;
5
3
} a;
You can’t perform that action at this time.
0 commit comments