@@ -477,8 +477,8 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
477
477
ty:: CoroutineClosure ( ..) => build_closure_env_di_node ( cx, unique_type_id) ,
478
478
ty:: Coroutine ( ..) => enums:: build_coroutine_di_node ( cx, unique_type_id) ,
479
479
ty:: Adt ( def, ..) => match def. adt_kind ( ) {
480
- AdtKind :: Struct => build_struct_type_di_node ( cx, unique_type_id) ,
481
- AdtKind :: Union => build_union_type_di_node ( cx, unique_type_id) ,
480
+ AdtKind :: Struct => build_struct_type_di_node ( cx, unique_type_id, span ) ,
481
+ AdtKind :: Union => build_union_type_di_node ( cx, unique_type_id, span ) ,
482
482
AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span) ,
483
483
} ,
484
484
ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
@@ -1076,14 +1076,15 @@ fn visibility_di_flags<'ll, 'tcx>(
1076
1076
fn build_struct_type_di_node < ' ll , ' tcx > (
1077
1077
cx : & CodegenCx < ' ll , ' tcx > ,
1078
1078
unique_type_id : UniqueTypeId < ' tcx > ,
1079
+ span : Span ,
1079
1080
) -> DINodeCreationResult < ' ll > {
1080
1081
let struct_type = unique_type_id. expect_ty ( ) ;
1081
1082
let ty:: Adt ( adt_def, _) = struct_type. kind ( ) else {
1082
1083
bug ! ( "build_struct_type_di_node() called with non-struct-type: {:?}" , struct_type) ;
1083
1084
} ;
1084
1085
assert ! ( adt_def. is_struct( ) ) ;
1085
1086
let containing_scope = get_namespace_for_item ( cx, adt_def. did ( ) ) ;
1086
- let struct_type_and_layout = cx. layout_of ( struct_type) ;
1087
+ let struct_type_and_layout = cx. spanned_layout_of ( struct_type, span ) ;
1087
1088
let variant_def = adt_def. non_enum_variant ( ) ;
1088
1089
let def_location = if cx. sess ( ) . opts . unstable_opts . debug_info_type_line_numbers {
1089
1090
Some ( file_metadata_from_def_id ( cx, Some ( adt_def. did ( ) ) ) )
@@ -1276,14 +1277,15 @@ fn build_closure_env_di_node<'ll, 'tcx>(
1276
1277
fn build_union_type_di_node < ' ll , ' tcx > (
1277
1278
cx : & CodegenCx < ' ll , ' tcx > ,
1278
1279
unique_type_id : UniqueTypeId < ' tcx > ,
1280
+ span : Span ,
1279
1281
) -> DINodeCreationResult < ' ll > {
1280
1282
let union_type = unique_type_id. expect_ty ( ) ;
1281
1283
let ( union_def_id, variant_def) = match union_type. kind ( ) {
1282
1284
ty:: Adt ( def, _) => ( def. did ( ) , def. non_enum_variant ( ) ) ,
1283
1285
_ => bug ! ( "build_union_type_di_node on a non-ADT" ) ,
1284
1286
} ;
1285
1287
let containing_scope = get_namespace_for_item ( cx, union_def_id) ;
1286
- let union_ty_and_layout = cx. layout_of ( union_type) ;
1288
+ let union_ty_and_layout = cx. spanned_layout_of ( union_type, span ) ;
1287
1289
let type_name = compute_debuginfo_type_name ( cx. tcx , union_type, false ) ;
1288
1290
let def_location = if cx. sess ( ) . opts . unstable_opts . debug_info_type_line_numbers {
1289
1291
Some ( file_metadata_from_def_id ( cx, Some ( union_def_id) ) )
0 commit comments