@@ -456,60 +456,17 @@ impl TypeMap {
456456 let return_type_id = self . get_unique_type_id_as_string ( return_type_id) ;
457457 unique_type_id. push_str ( return_type_id. as_slice ( ) ) ;
458458 } ,
459- ty:: ty_closure( box ty:: ClosureTy { fn_style,
460- onceness,
461- store,
462- ref bounds,
463- ref sig,
464- abi : _ } ) => {
465- if fn_style == ast:: UnsafeFn {
466- unique_type_id. push_str ( "unsafe " ) ;
467- }
468-
469- if onceness == ast:: Once {
470- unique_type_id. push_str ( "once " ) ;
471- }
472-
473- match store {
474- ty:: UniqTraitStore => unique_type_id. push_str ( "~|" ) ,
475- ty:: RegionTraitStore ( _, ast:: MutMutable ) => {
476- unique_type_id. push_str ( "&mut|" )
477- }
478- ty:: RegionTraitStore ( _, ast:: MutImmutable ) => {
479- unique_type_id. push_str ( "&|" )
480- }
481- } ;
482-
483- for & parameter_type in sig. inputs . iter ( ) {
484- let parameter_type_id =
485- self . get_unique_type_id_of_type ( cx, parameter_type) ;
486- let parameter_type_id =
487- self . get_unique_type_id_as_string ( parameter_type_id) ;
488- unique_type_id. push_str ( parameter_type_id. as_slice ( ) ) ;
489- unique_type_id. push_char ( ',' ) ;
490- }
491-
492- if sig. variadic {
493- unique_type_id. push_str ( "..." ) ;
494- }
495-
496- unique_type_id. push_str ( "|->" ) ;
497-
498- let return_type_id = self . get_unique_type_id_of_type ( cx, sig. output ) ;
499- let return_type_id = self . get_unique_type_id_as_string ( return_type_id) ;
500- unique_type_id. push_str ( return_type_id. as_slice ( ) ) ;
501-
502- unique_type_id. push_char ( ':' ) ;
503-
504- for bound in bounds. builtin_bounds . iter ( ) {
505- match bound {
506- ty:: BoundSend => unique_type_id. push_str ( "Send" ) ,
507- ty:: BoundSized => unique_type_id. push_str ( "Sized" ) ,
508- ty:: BoundCopy => unique_type_id. push_str ( "Copy" ) ,
509- ty:: BoundSync => unique_type_id. push_str ( "Sync" ) ,
510- } ;
511- unique_type_id. push_char ( '+' ) ;
512- }
459+ ty:: ty_closure( box ref closure_ty) => {
460+ self . get_unique_type_id_of_closure_type ( cx,
461+ closure_ty. clone ( ) ,
462+ & mut unique_type_id) ;
463+ } ,
464+ ty:: ty_unboxed_closure( ref def_id, _) => {
465+ let closure_ty = cx. tcx ( ) . unboxed_closures . borrow ( )
466+ . find ( def_id) . unwrap ( ) . closure_type . clone ( ) ;
467+ self . get_unique_type_id_of_closure_type ( cx,
468+ closure_ty,
469+ & mut unique_type_id) ;
513470 } ,
514471 _ => {
515472 cx. sess ( ) . bug ( format ! ( "get_unique_type_id_of_type() - unexpected type: {}, {:?}" ,
@@ -581,6 +538,66 @@ impl TypeMap {
581538 }
582539 }
583540
541+ fn get_unique_type_id_of_closure_type ( & mut self ,
542+ cx : & CrateContext ,
543+ closure_ty : ty:: ClosureTy ,
544+ unique_type_id : & mut String ) {
545+ let ty:: ClosureTy { fn_style,
546+ onceness,
547+ store,
548+ ref bounds,
549+ ref sig,
550+ abi : _ } = closure_ty;
551+ if fn_style == ast:: UnsafeFn {
552+ unique_type_id. push_str ( "unsafe " ) ;
553+ }
554+
555+ if onceness == ast:: Once {
556+ unique_type_id. push_str ( "once " ) ;
557+ }
558+
559+ match store {
560+ ty:: UniqTraitStore => unique_type_id. push_str ( "~|" ) ,
561+ ty:: RegionTraitStore ( _, ast:: MutMutable ) => {
562+ unique_type_id. push_str ( "&mut|" )
563+ }
564+ ty:: RegionTraitStore ( _, ast:: MutImmutable ) => {
565+ unique_type_id. push_str ( "&|" )
566+ }
567+ } ;
568+
569+ for & parameter_type in sig. inputs . iter ( ) {
570+ let parameter_type_id =
571+ self . get_unique_type_id_of_type ( cx, parameter_type) ;
572+ let parameter_type_id =
573+ self . get_unique_type_id_as_string ( parameter_type_id) ;
574+ unique_type_id. push_str ( parameter_type_id. as_slice ( ) ) ;
575+ unique_type_id. push_char ( ',' ) ;
576+ }
577+
578+ if sig. variadic {
579+ unique_type_id. push_str ( "..." ) ;
580+ }
581+
582+ unique_type_id. push_str ( "|->" ) ;
583+
584+ let return_type_id = self . get_unique_type_id_of_type ( cx, sig. output ) ;
585+ let return_type_id = self . get_unique_type_id_as_string ( return_type_id) ;
586+ unique_type_id. push_str ( return_type_id. as_slice ( ) ) ;
587+
588+ unique_type_id. push_char ( ':' ) ;
589+
590+ for bound in bounds. builtin_bounds . iter ( ) {
591+ match bound {
592+ ty:: BoundSend => unique_type_id. push_str ( "Send" ) ,
593+ ty:: BoundSized => unique_type_id. push_str ( "Sized" ) ,
594+ ty:: BoundCopy => unique_type_id. push_str ( "Copy" ) ,
595+ ty:: BoundSync => unique_type_id. push_str ( "Sync" ) ,
596+ } ;
597+ unique_type_id. push_char ( '+' ) ;
598+ }
599+ }
600+
584601 // Get the UniqueTypeId for an enum variant. Enum variants are not really
585602 // types of their own, so they need special handling. We still need a
586603 // UniqueTypeId for them, since to debuginfo they *are* real types.
@@ -2903,6 +2920,11 @@ fn type_metadata(cx: &CrateContext,
29032920 ty:: ty_closure( ref closurety) => {
29042921 subroutine_type_metadata ( cx, unique_type_id, & closurety. sig , usage_site_span)
29052922 }
2923+ ty:: ty_unboxed_closure( ref def_id, _) => {
2924+ let sig = cx. tcx ( ) . unboxed_closures . borrow ( )
2925+ . find ( def_id) . unwrap ( ) . closure_type . sig . clone ( ) ;
2926+ subroutine_type_metadata ( cx, unique_type_id, & sig, usage_site_span)
2927+ }
29062928 ty:: ty_struct( def_id, ref substs) => {
29072929 prepare_struct_metadata ( cx,
29082930 t,
0 commit comments