@@ -700,6 +700,8 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
700
700
prepare_tuple_metadata ( cx, t, & tys, unique_type_id, usage_site_span, NO_SCOPE_METADATA )
701
701
. finalize ( cx)
702
702
}
703
+ // Type parameters from polymorphized functions.
704
+ ty:: Param ( _) => MetadataCreationResult :: new ( param_type_metadata ( cx, t) , false ) ,
703
705
_ => bug ! ( "debuginfo: unexpected type in type_metadata: {:?}" , t) ,
704
706
} ;
705
707
@@ -955,6 +957,20 @@ fn pointer_type_metadata(
955
957
}
956
958
}
957
959
960
+ fn param_type_metadata ( cx : & CodegenCx < ' ll , ' tcx > , t : Ty < ' tcx > ) -> & ' ll DIType {
961
+ debug ! ( "param_type_metadata: {:?}" , t) ;
962
+ let name = format ! ( "{:?}" , t) ;
963
+ return unsafe {
964
+ llvm:: LLVMRustDIBuilderCreateBasicType (
965
+ DIB ( cx) ,
966
+ name. as_ptr ( ) . cast ( ) ,
967
+ name. len ( ) ,
968
+ Size :: ZERO . bits ( ) ,
969
+ DW_ATE_unsigned ,
970
+ )
971
+ } ;
972
+ }
973
+
958
974
pub fn compile_unit_metadata (
959
975
tcx : TyCtxt < ' _ > ,
960
976
codegen_unit_name : & str ,
@@ -2465,7 +2481,7 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
2465
2481
} ;
2466
2482
2467
2483
let is_local_to_unit = is_node_local_to_unit ( cx, def_id) ;
2468
- let variable_type = Instance :: mono ( cx. tcx , def_id) . monomorphic_ty ( cx. tcx ) ;
2484
+ let variable_type = Instance :: mono ( cx. tcx , def_id) . ty ( cx. tcx , ty :: ParamEnv :: reveal_all ( ) ) ;
2469
2485
let type_metadata = type_metadata ( cx, variable_type, span) ;
2470
2486
let var_name = tcx. item_name ( def_id) . as_str ( ) ;
2471
2487
let linkage_name = mangled_name_of_instance ( cx, Instance :: mono ( tcx, def_id) ) . name ;
0 commit comments