@@ -454,9 +454,6 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
454454 ty:: RawPtr ( pointee_type, _) | ty:: Ref ( _, pointee_type, _) => {
455455 build_pointer_or_reference_di_node ( cx, t, pointee_type, unique_type_id)
456456 }
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).
460457 ty:: Adt ( def, args)
461458 if def. is_box ( )
462459 && 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>(
473470 AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span) ,
474471 } ,
475472 ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
473+ ty:: Field ( ..) => build_field_type_di_node ( cx, unique_type_id) ,
476474 _ => bug ! ( "debuginfo: unexpected type in type_di_node(): {:?}" , t) ,
477475 } ;
478476
@@ -1261,6 +1259,32 @@ fn build_closure_env_di_node<'ll, 'tcx>(
12611259 )
12621260}
12631261
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+
12641288/// Build the debuginfo node for a Rust `union` type.
12651289fn build_union_type_di_node < ' ll , ' tcx > (
12661290 cx : & CodegenCx < ' ll , ' tcx > ,
0 commit comments