@@ -477,8 +477,8 @@ pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
477477 ty:: CoroutineClosure ( ..) => build_closure_env_di_node ( cx, unique_type_id) ,
478478 ty:: Coroutine ( ..) => enums:: build_coroutine_di_node ( cx, unique_type_id) ,
479479 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 ) ,
482482 AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span) ,
483483 } ,
484484 ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
@@ -1076,14 +1076,15 @@ fn visibility_di_flags<'ll, 'tcx>(
10761076fn build_struct_type_di_node < ' ll , ' tcx > (
10771077 cx : & CodegenCx < ' ll , ' tcx > ,
10781078 unique_type_id : UniqueTypeId < ' tcx > ,
1079+ span : Span ,
10791080) -> DINodeCreationResult < ' ll > {
10801081 let struct_type = unique_type_id. expect_ty ( ) ;
10811082 let ty:: Adt ( adt_def, _) = struct_type. kind ( ) else {
10821083 bug ! ( "build_struct_type_di_node() called with non-struct-type: {:?}" , struct_type) ;
10831084 } ;
10841085 assert ! ( adt_def. is_struct( ) ) ;
10851086 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 ) ;
10871088 let variant_def = adt_def. non_enum_variant ( ) ;
10881089 let def_location = if cx. sess ( ) . opts . unstable_opts . debug_info_type_line_numbers {
10891090 Some ( file_metadata_from_def_id ( cx, Some ( adt_def. did ( ) ) ) )
@@ -1276,14 +1277,15 @@ fn build_closure_env_di_node<'ll, 'tcx>(
12761277fn build_union_type_di_node < ' ll , ' tcx > (
12771278 cx : & CodegenCx < ' ll , ' tcx > ,
12781279 unique_type_id : UniqueTypeId < ' tcx > ,
1280+ span : Span ,
12791281) -> DINodeCreationResult < ' ll > {
12801282 let union_type = unique_type_id. expect_ty ( ) ;
12811283 let ( union_def_id, variant_def) = match union_type. kind ( ) {
12821284 ty:: Adt ( def, _) => ( def. did ( ) , def. non_enum_variant ( ) ) ,
12831285 _ => bug ! ( "build_union_type_di_node on a non-ADT" ) ,
12841286 } ;
12851287 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 ) ;
12871289 let type_name = compute_debuginfo_type_name ( cx. tcx , union_type, false ) ;
12881290 let def_location = if cx. sess ( ) . opts . unstable_opts . debug_info_type_line_numbers {
12891291 Some ( file_metadata_from_def_id ( cx, Some ( union_def_id) ) )
0 commit comments