@@ -36,6 +36,7 @@ use glue;
3636use abi:: { Abi , FnType } ;
3737use back:: symbol_names;
3838use std:: fmt:: Write ;
39+ use std:: iter;
3940
4041#[ derive( PartialEq , Eq , Clone , Copy , Debug , Hash ) ]
4142pub enum TransItem < ' tcx > {
@@ -410,7 +411,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
410411 ty:: TyFloat ( ast:: FloatTy :: F64 ) => output. push_str ( "f64" ) ,
411412 ty:: TyAdt ( adt_def, substs) => {
412413 self . push_def_path ( adt_def. did , output) ;
413- self . push_type_params ( substs, & [ ] , output) ;
414+ self . push_type_params ( substs, iter :: empty ( ) , output) ;
414415 } ,
415416 ty:: TyTuple ( component_types) => {
416417 output. push ( '(' ) ;
@@ -461,7 +462,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
461462 if let Some ( principal) = trait_data. principal ( ) {
462463 self . push_def_path ( principal. def_id ( ) , output) ;
463464 self . push_type_params ( principal. skip_binder ( ) . substs ,
464- & trait_data. projection_bounds ( ) . collect :: < Vec < _ > > ( ) [ .. ] ,
465+ trait_data. projection_bounds ( ) ,
465466 output) ;
466467 }
467468 } ,
@@ -513,7 +514,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
513514 self . push_def_path ( def_id, output) ;
514515 let generics = self . tcx . item_generics ( self . tcx . closure_base_def_id ( def_id) ) ;
515516 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) ;
517518 }
518519 ty:: TyError |
519520 ty:: TyInfer ( _) |
@@ -553,11 +554,14 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
553554 output. pop ( ) ;
554555 }
555556
556- pub fn push_type_params ( & self ,
557+ fn push_type_params < I > ( & self ,
557558 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 ( ) {
561565 return ;
562566 }
563567
@@ -587,6 +591,6 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
587591 instance : Instance < ' tcx > ,
588592 output : & mut String ) {
589593 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) ;
591595 }
592596}
0 commit comments