@@ -13,9 +13,14 @@ use rustc::ty::fold::{TypeFoldable, TypeVisitor};
13
13
use rustc:: util:: nodemap:: FnvHashSet ;
14
14
15
15
#[ 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 ) }
19
24
}
20
25
21
26
/// If `include_projections` is false, returns the list of parameters that are
@@ -49,8 +54,8 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
49
54
// projections are not injective
50
55
return false ;
51
56
}
52
- ty:: TyParam ( ref d ) => {
53
- self . parameters . push ( Parameter :: Type ( d . clone ( ) ) ) ;
57
+ ty:: TyParam ( data ) => {
58
+ self . parameters . push ( Parameter :: from ( data ) ) ;
54
59
}
55
60
_ => { }
56
61
}
@@ -61,7 +66,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
61
66
fn visit_region ( & mut self , r : & ' tcx ty:: Region ) -> bool {
62
67
match * r {
63
68
ty:: ReEarlyBound ( data) => {
64
- self . parameters . push ( Parameter :: Region ( data) ) ;
69
+ self . parameters . push ( Parameter :: from ( data) ) ;
65
70
}
66
71
_ => { }
67
72
}
@@ -141,13 +146,15 @@ pub fn setup_constraining_predicates<'tcx>(predicates: &mut [ty::Predicate<'tcx>
141
146
// * <U as Iterator>::Item = T
142
147
// * T: Debug
143
148
// * U: Iterator
149
+ debug ! ( "setup_constraining_predicates: predicates={:?} \
150
+ impl_trait_ref={:?} input_parameters={:?}",
151
+ predicates, impl_trait_ref, input_parameters) ;
144
152
let mut i = 0 ;
145
153
let mut changed = true ;
146
154
while changed {
147
155
changed = false ;
148
156
149
157
for j in i..predicates. len ( ) {
150
-
151
158
if let ty:: Predicate :: Projection ( ref poly_projection) = predicates[ j] {
152
159
// Note that we can skip binder here because the impl
153
160
// trait ref never contains any late-bound regions.
@@ -181,5 +188,8 @@ pub fn setup_constraining_predicates<'tcx>(predicates: &mut [ty::Predicate<'tcx>
181
188
i += 1 ;
182
189
changed = true ;
183
190
}
191
+ debug ! ( "setup_constraining_predicates: predicates={:?} \
192
+ i={} impl_trait_ref={:?} input_parameters={:?}",
193
+ predicates, i, impl_trait_ref, input_parameters) ;
184
194
}
185
195
}
0 commit comments