@@ -323,26 +323,28 @@ impl<'tcx> TypeMap<'tcx> {
323
323
fn get_unique_type_id_of_type < ' a > ( & mut self , cx : & CrateContext < ' a , ' tcx > ,
324
324
type_ : Ty < ' tcx > ) -> UniqueTypeId {
325
325
326
- // basic type -> {:name of the type:}
327
- // tuple -> {tuple_(:param-uid:)*}
328
- // struct -> {struct_:svh: / :node-id:_<(:param-uid:),*> }
329
- // enum -> {enum_:svh: / :node-id:_<(:param-uid:),*> }
330
- // enum variant -> {variant_:variant-name:_:enum-uid:}
331
- // reference (&) -> {& :pointee-uid:}
332
- // mut reference (&mut) -> {&mut :pointee-uid:}
333
- // ptr (*) -> {* :pointee-uid:}
334
- // mut ptr (*mut) -> {*mut :pointee-uid:}
335
- // unique ptr (~) -> {~ :pointee-uid:}
336
- // @-ptr (@) -> {@ :pointee-uid:}
337
- // sized vec ([T; x]) -> {[:size:] :element-uid:}
338
- // unsized vec ([T]) -> {[] :element-uid:}
339
- // trait (T) -> {trait_:svh: / :node-id:_<(:param-uid:),*> }
340
- // closure -> {<unsafe_> <once_> :store-sigil: |(:param-uid:),* <,_...>| -> \
341
- // :return-type-uid: : (:bounds:)*}
342
- // function -> {<unsafe_> <abi_> fn( (:param-uid:)* <,_...> ) -> \
343
- // :return-type-uid:}
344
- // unique vec box (~[]) -> {HEAP_VEC_BOX<:pointee-uid:>}
345
- // gc box -> {GC_BOX<:pointee-uid:>}
326
+ // basic type -> {:name of the type:}
327
+ // tuple -> {tuple_(:param-uid:)*}
328
+ // struct -> {struct_:svh: / :node-id:_<(:param-uid:),*> }
329
+ // enum -> {enum_:svh: / :node-id:_<(:param-uid:),*> }
330
+ // enum variant -> {variant_:variant-name:_:enum-uid:}
331
+ // reference (&) -> {& :pointee-uid:}
332
+ // mut reference (&mut) -> {&mut :pointee-uid:}
333
+ // ptr (*) -> {* :pointee-uid:}
334
+ // mut ptr (*mut) -> {*mut :pointee-uid:}
335
+ // unique ptr (~) -> {~ :pointee-uid:}
336
+ // @-ptr (@) -> {@ :pointee-uid:}
337
+ // sized vec ([T; x]) -> {[:size:] :element-uid:}
338
+ // unsized vec ([T]) -> {[] :element-uid:}
339
+ // trait (T) -> {trait_:svh: / :node-id:_<(:param-uid:),*> }
340
+ // closure -> {<unsafe_> <once_> :store-sigil:
341
+ // |(:param-uid:),* <,_...>| -> \
342
+ // :return-type-uid: : (:bounds:)*}
343
+ // function -> {<unsafe_> <abi_> fn( (:param-uid:)* <,_...> ) -> \
344
+ // :return-type-uid:}
345
+ // unique vec box (~[]) -> {HEAP_VEC_BOX<:pointee-uid:>}
346
+ // gc box -> {GC_BOX<:pointee-uid:>}
347
+ // projection (<T as U>::V) -> {<:ty-uid: as :trait-uid:> :: :name-uid: }
346
348
347
349
match self . type_to_unique_id . get ( & type_) . cloned ( ) {
348
350
Some ( unique_type_id) => return unique_type_id,
@@ -435,6 +437,25 @@ impl<'tcx> TypeMap<'tcx> {
435
437
principal. substs ,
436
438
& mut unique_type_id) ;
437
439
} ,
440
+ ty:: ty_projection( ref projection) => {
441
+ unique_type_id. push_str ( "<" ) ;
442
+
443
+ let self_ty = projection. trait_ref . self_ty ( ) ;
444
+ let self_type_id = self . get_unique_type_id_of_type ( cx, self_ty) ;
445
+ let self_type_id = self . get_unique_type_id_as_string ( self_type_id) ;
446
+ unique_type_id. push_str ( & self_type_id[ ] ) ;
447
+
448
+ unique_type_id. push_str ( " as " ) ;
449
+
450
+ from_def_id_and_substs ( self ,
451
+ cx,
452
+ projection. trait_ref . def_id ,
453
+ projection. trait_ref . substs ,
454
+ & mut unique_type_id) ;
455
+
456
+ unique_type_id. push_str ( ">::" ) ;
457
+ unique_type_id. push_str ( token:: get_name ( projection. item_name ) . get ( ) ) ;
458
+ } ,
438
459
ty:: ty_bare_fn( _, & ty:: BareFnTy { unsafety, abi, ref sig } ) => {
439
460
if unsafety == ast:: Unsafety :: Unsafe {
440
461
unique_type_id. push_str ( "unsafe " ) ;
@@ -478,7 +499,10 @@ impl<'tcx> TypeMap<'tcx> {
478
499
closure_ty,
479
500
& mut unique_type_id) ;
480
501
} ,
481
- _ => {
502
+ ty:: ty_err |
503
+ ty:: ty_infer( _) |
504
+ ty:: ty_open( _) |
505
+ ty:: ty_param( _) => {
482
506
cx. sess ( ) . bug ( & format ! ( "get_unique_type_id_of_type() - unexpected type: {}, {:?}" ,
483
507
& ppaux:: ty_to_string( cx. tcx( ) , type_) [ ] ,
484
508
type_. sty) [ ] )
@@ -3855,10 +3879,22 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
3855
3879
ty:: ty_unboxed_closure( ..) => {
3856
3880
output. push_str ( "closure" ) ;
3857
3881
}
3882
+ ty:: ty_projection( ref projection) => {
3883
+ output. push_str ( "<" ) ;
3884
+ let self_ty = projection. trait_ref . self_ty ( ) ;
3885
+ push_debuginfo_type_name ( cx, self_ty, true , output) ;
3886
+
3887
+ output. push_str ( " as " ) ;
3888
+
3889
+ push_item_name ( cx, projection. trait_ref . def_id , false , output) ;
3890
+ push_type_params ( cx, projection. trait_ref . substs , output) ;
3891
+
3892
+ output. push_str ( ">::" ) ;
3893
+ output. push_str ( token:: get_name ( projection. item_name ) . get ( ) ) ;
3894
+ }
3858
3895
ty:: ty_err |
3859
3896
ty:: ty_infer( _) |
3860
3897
ty:: ty_open( _) |
3861
- ty:: ty_projection( ..) |
3862
3898
ty:: ty_param( _) => {
3863
3899
cx. sess ( ) . bug ( & format ! ( "debuginfo: Trying to create type name for \
3864
3900
unexpected type: {}", ppaux:: ty_to_string( cx. tcx( ) , t) ) [ ] ) ;
0 commit comments