@@ -700,6 +700,8 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
700700 prepare_tuple_metadata ( cx, t, & tys, unique_type_id, usage_site_span, NO_SCOPE_METADATA )
701701 . finalize ( cx)
702702 }
703+ // Type parameters from polymorphized functions.
704+ ty:: Param ( _) => MetadataCreationResult :: new ( param_type_metadata ( cx, t) , false ) ,
703705 _ => bug ! ( "debuginfo: unexpected type in type_metadata: {:?}" , t) ,
704706 } ;
705707
@@ -955,6 +957,20 @@ fn pointer_type_metadata(
955957 }
956958}
957959
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+
958974pub fn compile_unit_metadata (
959975 tcx : TyCtxt < ' _ > ,
960976 codegen_unit_name : & str ,
@@ -2465,7 +2481,7 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
24652481 } ;
24662482
24672483 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 ( ) ) ;
24692485 let type_metadata = type_metadata ( cx, variable_type, span) ;
24702486 let var_name = tcx. item_name ( def_id) . as_str ( ) ;
24712487 let linkage_name = mangled_name_of_instance ( cx, Instance :: mono ( tcx, def_id) ) . name ;
0 commit comments