File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1559,7 +1559,7 @@ impl CodeGenerator for CompInfo {
1559
1559
struct_layout. saw_vtable ( ) ;
1560
1560
}
1561
1561
1562
- for ( i , base) in self . base_members ( ) . iter ( ) . enumerate ( ) {
1562
+ for base in self . base_members ( ) {
1563
1563
// Virtual bases are already taken into account by the vtable
1564
1564
// pointer.
1565
1565
//
@@ -1577,11 +1577,7 @@ impl CodeGenerator for CompInfo {
1577
1577
}
1578
1578
1579
1579
let inner = base. ty . to_rust_ty_or_opaque ( ctx, & ( ) ) ;
1580
- let field_name = ctx. rust_ident ( if i == 0 {
1581
- "_base" . into ( )
1582
- } else {
1583
- format ! ( "_base_{}" , i)
1584
- } ) ;
1580
+ let field_name = ctx. rust_ident ( & base. field_name ) ;
1585
1581
1586
1582
struct_layout. saw_base ( base_ty) ;
1587
1583
Original file line number Diff line number Diff line change @@ -769,6 +769,8 @@ pub struct Base {
769
769
pub ty : ItemId ,
770
770
/// The kind of inheritance we're doing.
771
771
pub kind : BaseKind ,
772
+ /// Name of the field in which this base should be stored.
773
+ pub field_name : String ,
772
774
}
773
775
774
776
impl Base {
@@ -1155,11 +1157,16 @@ impl CompInfo {
1155
1157
BaseKind :: Normal
1156
1158
} ;
1157
1159
1160
+ let field_name = match ci. base_members . len ( ) {
1161
+ 0 => "_base" . into ( ) ,
1162
+ n => format ! ( "_base_{}" , n) ,
1163
+ } ;
1158
1164
let type_id =
1159
1165
Item :: from_ty_or_ref ( cur. cur_type ( ) , cur, None , ctx) ;
1160
1166
ci. base_members . push ( Base {
1161
1167
ty : type_id,
1162
1168
kind : kind,
1169
+ field_name : field_name,
1163
1170
} ) ;
1164
1171
}
1165
1172
CXCursor_Constructor |
You can’t perform that action at this time.
0 commit comments