@@ -469,8 +469,8 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
469
469
ty:: CoroutineClosure ( ..) => build_closure_env_di_node ( cx, unique_type_id) ,
470
470
ty:: Coroutine ( ..) => enums:: build_coroutine_di_node ( cx, unique_type_id) ,
471
471
ty:: Adt ( def, ..) => match def. adt_kind ( ) {
472
- AdtKind :: Struct => build_struct_type_di_node ( cx, unique_type_id) ,
473
- AdtKind :: Union => build_union_type_di_node ( cx, unique_type_id) ,
472
+ AdtKind :: Struct => build_struct_type_di_node ( cx, unique_type_id, span ) ,
473
+ AdtKind :: Union => build_union_type_di_node ( cx, unique_type_id, span ) ,
474
474
AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span) ,
475
475
} ,
476
476
ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
@@ -1066,14 +1066,15 @@ fn visibility_di_flags<'ll, 'tcx>(
1066
1066
fn build_struct_type_di_node < ' ll , ' tcx > (
1067
1067
cx : & CodegenCx < ' ll , ' tcx > ,
1068
1068
unique_type_id : UniqueTypeId < ' tcx > ,
1069
+ span : Span ,
1069
1070
) -> DINodeCreationResult < ' ll > {
1070
1071
let struct_type = unique_type_id. expect_ty ( ) ;
1071
1072
let ty:: Adt ( adt_def, _) = struct_type. kind ( ) else {
1072
1073
bug ! ( "build_struct_type_di_node() called with non-struct-type: {:?}" , struct_type) ;
1073
1074
} ;
1074
1075
assert ! ( adt_def. is_struct( ) ) ;
1075
1076
let containing_scope = get_namespace_for_item ( cx, adt_def. did ( ) ) ;
1076
- let struct_type_and_layout = cx. layout_of ( struct_type) ;
1077
+ let struct_type_and_layout = cx. spanned_layout_of ( struct_type, span ) ;
1077
1078
let variant_def = adt_def. non_enum_variant ( ) ;
1078
1079
let def_location = if cx. sess ( ) . opts . unstable_opts . debug_info_type_line_numbers {
1079
1080
Some ( file_metadata_from_def_id ( cx, Some ( adt_def. did ( ) ) ) )
@@ -1266,14 +1267,15 @@ fn build_closure_env_di_node<'ll, 'tcx>(
1266
1267
fn build_union_type_di_node < ' ll , ' tcx > (
1267
1268
cx : & CodegenCx < ' ll , ' tcx > ,
1268
1269
unique_type_id : UniqueTypeId < ' tcx > ,
1270
+ span : Span ,
1269
1271
) -> DINodeCreationResult < ' ll > {
1270
1272
let union_type = unique_type_id. expect_ty ( ) ;
1271
1273
let ( union_def_id, variant_def) = match union_type. kind ( ) {
1272
1274
ty:: Adt ( def, _) => ( def. did ( ) , def. non_enum_variant ( ) ) ,
1273
1275
_ => bug ! ( "build_union_type_di_node on a non-ADT" ) ,
1274
1276
} ;
1275
1277
let containing_scope = get_namespace_for_item ( cx, union_def_id) ;
1276
- let union_ty_and_layout = cx. layout_of ( union_type) ;
1278
+ let union_ty_and_layout = cx. spanned_layout_of ( union_type, span ) ;
1277
1279
let type_name = compute_debuginfo_type_name ( cx. tcx , union_type, false ) ;
1278
1280
let def_location = if cx. sess ( ) . opts . unstable_opts . debug_info_type_line_numbers {
1279
1281
Some ( file_metadata_from_def_id ( cx, Some ( union_def_id) ) )
0 commit comments