@@ -454,9 +454,6 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
454
454
ty:: RawPtr ( pointee_type, _) | ty:: Ref ( _, pointee_type, _) => {
455
455
build_pointer_or_reference_di_node ( cx, t, pointee_type, unique_type_id)
456
456
}
457
- // Some `Box` are newtyped pointers, make debuginfo aware of that.
458
- // Only works if the allocator argument is a 1-ZST and hence irrelevant for layout
459
- // (or if there is no allocator argument).
460
457
ty:: Adt ( def, args)
461
458
if def. is_box ( )
462
459
&& args. get ( 1 ) . is_none_or ( |arg| cx. layout_of ( arg. expect_ty ( ) ) . is_1zst ( ) ) =>
@@ -473,6 +470,7 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
473
470
AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span) ,
474
471
} ,
475
472
ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
473
+ ty:: Field ( ..) => build_field_type_di_node ( cx, unique_type_id) ,
476
474
_ => bug ! ( "debuginfo: unexpected type in type_di_node(): {:?}" , t) ,
477
475
} ;
478
476
@@ -1261,6 +1259,32 @@ fn build_closure_env_di_node<'ll, 'tcx>(
1261
1259
)
1262
1260
}
1263
1261
1262
+ fn build_field_type_di_node < ' ll , ' tcx > (
1263
+ cx : & CodegenCx < ' ll , ' tcx > ,
1264
+ unique_type_id : UniqueTypeId < ' tcx > ,
1265
+ ) -> DINodeCreationResult < ' ll > {
1266
+ let ty = unique_type_id. expect_ty ( ) ;
1267
+ let ty:: Field ( _, _) = ty. kind ( ) else {
1268
+ bug ! ( "build_field_type_di_node() called with non-field-type: {ty:?}" )
1269
+ } ;
1270
+ let type_name = compute_debuginfo_type_name ( cx. tcx , ty, false ) ;
1271
+ type_map:: build_type_with_children (
1272
+ cx,
1273
+ type_map:: stub (
1274
+ cx,
1275
+ Stub :: Struct ,
1276
+ unique_type_id,
1277
+ & type_name,
1278
+ None ,
1279
+ cx. size_and_align_of ( ty) ,
1280
+ None ,
1281
+ DIFlags :: FlagZero ,
1282
+ ) ,
1283
+ |_, _| smallvec ! [ ] ,
1284
+ NO_GENERICS ,
1285
+ )
1286
+ }
1287
+
1264
1288
/// Build the debuginfo node for a Rust `union` type.
1265
1289
fn build_union_type_di_node < ' ll , ' tcx > (
1266
1290
cx : & CodegenCx < ' ll , ' tcx > ,
0 commit comments