@@ -26,7 +26,6 @@ use llvm::debuginfo::{DIType, DIFile, DIScope, DIDescriptor, DICompositeType};
2626use metadata:: csearch;
2727use middle:: pat_util;
2828use middle:: subst:: { self , Substs } ;
29- use middle:: infer;
3029use rustc:: ast_map;
3130use trans:: { type_of, adt, machine, monomorphize} ;
3231use trans:: common:: { self , CrateContext , FunctionContext , Block } ;
@@ -287,12 +286,18 @@ impl<'tcx> TypeMap<'tcx> {
287286 }
288287 }
289288 } ,
290- ty:: TyClosure ( def_id, ref substs) => {
291- let infcx = infer:: normalizing_infer_ctxt ( cx. tcx ( ) , & cx. tcx ( ) . tables ) ;
292- let closure_ty = infcx. closure_type ( def_id, substs) ;
293- self . get_unique_type_id_of_closure_type ( cx,
294- closure_ty,
295- & mut unique_type_id) ;
289+ ty:: TyClosure ( _, ref substs) if substs. upvar_tys . is_empty ( ) => {
290+ push_debuginfo_type_name ( cx, type_, false , & mut unique_type_id) ;
291+ } ,
292+ ty:: TyClosure ( _, ref substs) => {
293+ unique_type_id. push_str ( "closure " ) ;
294+ for upvar_type in & substs. upvar_tys {
295+ let upvar_type_id =
296+ self . get_unique_type_id_of_type ( cx, upvar_type) ;
297+ let upvar_type_id =
298+ self . get_unique_type_id_as_string ( upvar_type_id) ;
299+ unique_type_id. push_str ( & upvar_type_id[ ..] ) ;
300+ }
296301 } ,
297302 _ => {
298303 cx. sess ( ) . bug ( & format ! ( "get_unique_type_id_of_type() - unexpected type: {:?}" ,
@@ -361,49 +366,6 @@ impl<'tcx> TypeMap<'tcx> {
361366 }
362367 }
363368
364- fn get_unique_type_id_of_closure_type < ' a > ( & mut self ,
365- cx : & CrateContext < ' a , ' tcx > ,
366- closure_ty : ty:: ClosureTy < ' tcx > ,
367- unique_type_id : & mut String ) {
368- let ty:: ClosureTy { unsafety,
369- ref sig,
370- abi : _ } = closure_ty;
371-
372- if unsafety == ast:: Unsafety :: Unsafe {
373- unique_type_id. push_str ( "unsafe " ) ;
374- }
375-
376- unique_type_id. push_str ( "|" ) ;
377-
378- let sig = cx. tcx ( ) . erase_late_bound_regions ( sig) ;
379-
380- for & parameter_type in & sig. inputs {
381- let parameter_type_id =
382- self . get_unique_type_id_of_type ( cx, parameter_type) ;
383- let parameter_type_id =
384- self . get_unique_type_id_as_string ( parameter_type_id) ;
385- unique_type_id. push_str ( & parameter_type_id[ ..] ) ;
386- unique_type_id. push ( ',' ) ;
387- }
388-
389- if sig. variadic {
390- unique_type_id. push_str ( "..." ) ;
391- }
392-
393- unique_type_id. push_str ( "|->" ) ;
394-
395- match sig. output {
396- ty:: FnConverging ( ret_ty) => {
397- let return_type_id = self . get_unique_type_id_of_type ( cx, ret_ty) ;
398- let return_type_id = self . get_unique_type_id_as_string ( return_type_id) ;
399- unique_type_id. push_str ( & return_type_id[ ..] ) ;
400- }
401- ty:: FnDiverging => {
402- unique_type_id. push_str ( "!" ) ;
403- }
404- }
405- }
406-
407369 // Get the UniqueTypeId for an enum variant. Enum variants are not really
408370 // types of their own, so they need special handling. We still need a
409371 // UniqueTypeId for them, since to debuginfo they *are* real types.
0 commit comments