@@ -36,6 +36,7 @@ use glue;
36
36
use abi:: { Abi , FnType } ;
37
37
use back:: symbol_names;
38
38
use std:: fmt:: Write ;
39
+ use std:: iter;
39
40
40
41
#[ derive( PartialEq , Eq , Clone , Copy , Debug , Hash ) ]
41
42
pub enum TransItem < ' tcx > {
@@ -410,7 +411,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
410
411
ty:: TyFloat ( ast:: FloatTy :: F64 ) => output. push_str ( "f64" ) ,
411
412
ty:: TyAdt ( adt_def, substs) => {
412
413
self . push_def_path ( adt_def. did , output) ;
413
- self . push_type_params ( substs, & [ ] , output) ;
414
+ self . push_type_params ( substs, iter :: empty ( ) , output) ;
414
415
} ,
415
416
ty:: TyTuple ( component_types) => {
416
417
output. push ( '(' ) ;
@@ -461,7 +462,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
461
462
if let Some ( principal) = trait_data. principal ( ) {
462
463
self . push_def_path ( principal. def_id ( ) , output) ;
463
464
self . push_type_params ( principal. skip_binder ( ) . substs ,
464
- & trait_data. projection_bounds ( ) . collect :: < Vec < _ > > ( ) [ .. ] ,
465
+ trait_data. projection_bounds ( ) ,
465
466
output) ;
466
467
}
467
468
} ,
@@ -513,7 +514,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
513
514
self . push_def_path ( def_id, output) ;
514
515
let generics = self . tcx . item_generics ( self . tcx . closure_base_def_id ( def_id) ) ;
515
516
let substs = closure_substs. substs . truncate_to ( self . tcx , generics) ;
516
- self . push_type_params ( substs, & [ ] , output) ;
517
+ self . push_type_params ( substs, iter :: empty ( ) , output) ;
517
518
}
518
519
ty:: TyError |
519
520
ty:: TyInfer ( _) |
@@ -553,11 +554,14 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
553
554
output. pop ( ) ;
554
555
}
555
556
556
- pub fn push_type_params ( & self ,
557
+ fn push_type_params < I > ( & self ,
557
558
substs : & Substs < ' tcx > ,
558
- projections : & [ ty:: PolyExistentialProjection < ' tcx > ] ,
559
- output : & mut String ) {
560
- if substs. types ( ) . next ( ) . is_none ( ) && projections. is_empty ( ) {
559
+ projections : I ,
560
+ output : & mut String )
561
+ where I : Iterator < Item =ty:: PolyExistentialProjection < ' tcx > >
562
+ {
563
+ let mut projections = projections. peekable ( ) ;
564
+ if substs. types ( ) . next ( ) . is_none ( ) && projections. peek ( ) . is_none ( ) {
561
565
return ;
562
566
}
563
567
@@ -587,6 +591,6 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
587
591
instance : Instance < ' tcx > ,
588
592
output : & mut String ) {
589
593
self . push_def_path ( instance. def , output) ;
590
- self . push_type_params ( instance. substs , & [ ] , output) ;
594
+ self . push_type_params ( instance. substs , iter :: empty ( ) , output) ;
591
595
}
592
596
}
0 commit comments