@@ -50,13 +50,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
50
50
/// unified.
51
51
pub fn fudge_inference_if_ok < T , E , F > (
52
52
& self ,
53
- origin : & RegionVariableOrigin ,
54
53
f : F ,
55
54
) -> Result < T , E > where
56
55
F : FnOnce ( ) -> Result < T , E > ,
57
56
T : TypeFoldable < ' tcx > ,
58
57
{
59
- debug ! ( "fudge_inference_if_ok(origin={:?})" , origin ) ;
58
+ debug ! ( "fudge_inference_if_ok()" ) ;
60
59
61
60
let ( mut fudger, value) = self . probe ( |snapshot| {
62
61
match f ( ) {
@@ -88,7 +87,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
88
87
int_vars,
89
88
float_vars,
90
89
region_vars,
91
- origin,
92
90
} ;
93
91
94
92
Ok ( ( fudger, value) )
@@ -120,8 +118,7 @@ pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
120
118
type_vars : FxHashMap < TyVid , TypeVariableOrigin > ,
121
119
int_vars : Range < IntVid > ,
122
120
float_vars : Range < FloatVid > ,
123
- region_vars : Range < RegionVid > ,
124
- origin : & ' a RegionVariableOrigin ,
121
+ region_vars : FxHashMap < RegionVid , RegionVariableOrigin > ,
125
122
}
126
123
127
124
impl < ' a , ' gcx , ' tcx > TypeFolder < ' gcx , ' tcx > for InferenceFudger < ' a , ' gcx , ' tcx > {
@@ -167,11 +164,11 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx>
167
164
}
168
165
169
166
fn fold_region ( & mut self , r : ty:: Region < ' tcx > ) -> ty:: Region < ' tcx > {
170
- match * r {
171
- ty :: ReVar ( vid ) if self . region_vars . contains ( & vid) => {
172
- self . infcx . next_region_var ( self . origin . clone ( ) )
167
+ if let ty :: ReVar ( vid ) = r {
168
+ if let Some ( & origin ) = self . region_vars . get ( & vid) {
169
+ return self . infcx . next_region_var ( origin) ;
173
170
}
174
- _ => r,
175
171
}
172
+ r
176
173
}
177
174
}
0 commit comments