@@ -13,9 +13,14 @@ use rustc::ty::fold::{TypeFoldable, TypeVisitor};
1313use rustc:: util:: nodemap:: FnvHashSet ;
1414
1515#[ derive( Clone , PartialEq , Eq , Hash , Debug ) ]
16- pub enum Parameter {
17- Type ( ty:: ParamTy ) ,
18- Region ( ty:: EarlyBoundRegion ) ,
16+ pub struct Parameter ( pub u32 ) ;
17+
18+ impl From < ty:: ParamTy > for Parameter {
19+ fn from ( param : ty:: ParamTy ) -> Self { Parameter ( param. idx ) }
20+ }
21+
22+ impl From < ty:: EarlyBoundRegion > for Parameter {
23+ fn from ( param : ty:: EarlyBoundRegion ) -> Self { Parameter ( param. index ) }
1924}
2025
2126/// If `include_projections` is false, returns the list of parameters that are
@@ -49,8 +54,8 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
4954 // projections are not injective
5055 return false ;
5156 }
52- ty:: TyParam ( ref d ) => {
53- self . parameters . push ( Parameter :: Type ( d . clone ( ) ) ) ;
57+ ty:: TyParam ( data ) => {
58+ self . parameters . push ( Parameter :: from ( data ) ) ;
5459 }
5560 _ => { }
5661 }
@@ -61,7 +66,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
6166 fn visit_region ( & mut self , r : & ' tcx ty:: Region ) -> bool {
6267 match * r {
6368 ty:: ReEarlyBound ( data) => {
64- self . parameters . push ( Parameter :: Region ( data) ) ;
69+ self . parameters . push ( Parameter :: from ( data) ) ;
6570 }
6671 _ => { }
6772 }
@@ -141,13 +146,15 @@ pub fn setup_constraining_predicates<'tcx>(predicates: &mut [ty::Predicate<'tcx>
141146 // * <U as Iterator>::Item = T
142147 // * T: Debug
143148 // * U: Iterator
149+ debug ! ( "setup_constraining_predicates: predicates={:?} \
150+ impl_trait_ref={:?} input_parameters={:?}",
151+ predicates, impl_trait_ref, input_parameters) ;
144152 let mut i = 0 ;
145153 let mut changed = true ;
146154 while changed {
147155 changed = false ;
148156
149157 for j in i..predicates. len ( ) {
150-
151158 if let ty:: Predicate :: Projection ( ref poly_projection) = predicates[ j] {
152159 // Note that we can skip binder here because the impl
153160 // trait ref never contains any late-bound regions.
@@ -181,5 +188,8 @@ pub fn setup_constraining_predicates<'tcx>(predicates: &mut [ty::Predicate<'tcx>
181188 i += 1 ;
182189 changed = true ;
183190 }
191+ debug ! ( "setup_constraining_predicates: predicates={:?} \
192+ i={} impl_trait_ref={:?} input_parameters={:?}",
193+ predicates, i, impl_trait_ref, input_parameters) ;
184194 }
185195}
0 commit comments