@@ -1290,21 +1290,31 @@ fn build_generic_type_param_di_nodes<'ll, 'tcx>(
12901290 ty : Ty < ' tcx > ,
12911291) -> SmallVec < Option < & ' ll DIType > > {
12921292 if let ty:: Adt ( def, args) = * ty. kind ( ) {
1293- if args. types ( ) . next ( ) . is_some ( ) {
1294- let generics = cx. tcx . generics_of ( def. did ( ) ) ;
1295- let names = get_parameter_names ( cx, generics) ;
1296- let template_params: SmallVec < _ > = iter:: zip ( args, names)
1297- . filter_map ( |( kind, name) | {
1298- kind. as_type ( ) . map ( |ty| {
1299- let actual_type = cx. tcx . normalize_erasing_regions ( cx. typing_env ( ) , ty) ;
1300- let actual_type_di_node = type_di_node ( cx, actual_type) ;
1301- Some ( cx. create_template_type_parameter ( name. as_str ( ) , actual_type_di_node) )
1302- } )
1293+ let generics = cx. tcx . generics_of ( def. did ( ) ) ;
1294+ return get_template_parameters ( cx, generics, args) ;
1295+ }
1296+
1297+ return smallvec ! [ ] ;
1298+ }
1299+
1300+ pub ( super ) fn get_template_parameters < ' ll , ' tcx > (
1301+ cx : & CodegenCx < ' ll , ' tcx > ,
1302+ generics : & ty:: Generics ,
1303+ args : ty:: GenericArgsRef < ' tcx > ,
1304+ ) -> SmallVec < Option < & ' ll DIType > > {
1305+ if args. types ( ) . next ( ) . is_some ( ) {
1306+ let names = get_parameter_names ( cx, generics) ;
1307+ let template_params: SmallVec < _ > = iter:: zip ( args, names)
1308+ . filter_map ( |( kind, name) | {
1309+ kind. as_type ( ) . map ( |ty| {
1310+ let actual_type = cx. tcx . normalize_erasing_regions ( cx. typing_env ( ) , ty) ;
1311+ let actual_type_di_node = type_di_node ( cx, actual_type) ;
1312+ Some ( cx. create_template_type_parameter ( name. as_str ( ) , actual_type_di_node) )
13031313 } )
1304- . collect ( ) ;
1314+ } )
1315+ . collect ( ) ;
13051316
1306- return template_params;
1307- }
1317+ return template_params;
13081318 }
13091319
13101320 return smallvec ! [ ] ;
0 commit comments