@@ -19,7 +19,9 @@ use rustc_middle::ty::{
1919 self , AdtKind , CoroutineArgsExt , ExistentialTraitRef , Instance , Ty , TyCtxt , Visibility ,
2020} ;
2121use rustc_session:: config:: { self , DebugInfo , Lto } ;
22- use rustc_span:: { DUMMY_SP , FileName , FileNameDisplayPreference , SourceFile , Symbol , hygiene} ;
22+ use rustc_span:: {
23+ DUMMY_SP , FileName , FileNameDisplayPreference , SourceFile , Span , Symbol , hygiene,
24+ } ;
2325use rustc_symbol_mangling:: typeid_for_trait_ref;
2426use rustc_target:: spec:: DebuginfoKind ;
2527use smallvec:: smallvec;
@@ -423,6 +425,14 @@ fn build_slice_type_di_node<'ll, 'tcx>(
423425/// This function will look up the debuginfo node in the TypeMap. If it can't find it, it
424426/// will create the node by dispatching to the corresponding `build_*_di_node()` function.
425427pub ( crate ) fn type_di_node < ' ll , ' tcx > ( cx : & CodegenCx < ' ll , ' tcx > , t : Ty < ' tcx > ) -> & ' ll DIType {
428+ spanned_type_di_node ( cx, t, DUMMY_SP )
429+ }
430+
431+ pub ( crate ) fn spanned_type_di_node < ' ll , ' tcx > (
432+ cx : & CodegenCx < ' ll , ' tcx > ,
433+ t : Ty < ' tcx > ,
434+ span : Span ,
435+ ) -> & ' ll DIType {
426436 let unique_type_id = UniqueTypeId :: for_ty ( cx. tcx , t) ;
427437
428438 if let Some ( existing_di_node) = debug_context ( cx) . type_map . di_node_for_unique_id ( unique_type_id)
@@ -460,7 +470,7 @@ pub(crate) fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) ->
460470 ty:: Adt ( def, ..) => match def. adt_kind ( ) {
461471 AdtKind :: Struct => build_struct_type_di_node ( cx, unique_type_id) ,
462472 AdtKind :: Union => build_union_type_di_node ( cx, unique_type_id) ,
463- AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id) ,
473+ AdtKind :: Enum => enums:: build_enum_type_di_node ( cx, unique_type_id, span ) ,
464474 } ,
465475 ty:: Tuple ( _) => build_tuple_type_di_node ( cx, unique_type_id) ,
466476 _ => bug ! ( "debuginfo: unexpected type in type_di_node(): {:?}" , t) ,
0 commit comments