@@ -48,7 +48,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
48
48
pub fn canonicalize_query < V > (
49
49
& self ,
50
50
value : & V ,
51
- var_values : & mut SmallCanonicalVarValues < ' tcx >
51
+ var_values : & mut SmallCanonicalVarValues < ' tcx > ,
52
52
) -> Canonicalized < ' gcx , V >
53
53
where
54
54
V : TypeFoldable < ' tcx > + Lift < ' gcx > ,
@@ -96,10 +96,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
96
96
/// out the [chapter in the rustc guide][c].
97
97
///
98
98
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
99
- pub fn canonicalize_response < V > (
100
- & self ,
101
- value : & V ,
102
- ) -> Canonicalized < ' gcx , V >
99
+ pub fn canonicalize_response < V > ( & self , value : & V ) -> Canonicalized < ' gcx , V >
103
100
where
104
101
V : TypeFoldable < ' tcx > + Lift < ' gcx > ,
105
102
{
@@ -112,7 +109,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
112
109
static_region : false ,
113
110
other_free_regions : false ,
114
111
} ,
115
- & mut var_values
112
+ & mut var_values,
116
113
)
117
114
}
118
115
@@ -128,7 +125,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
128
125
pub fn canonicalize_hr_query_hack < V > (
129
126
& self ,
130
127
value : & V ,
131
- var_values : & mut SmallCanonicalVarValues < ' tcx >
128
+ var_values : & mut SmallCanonicalVarValues < ' tcx > ,
132
129
) -> Canonicalized < ' gcx , V >
133
130
where
134
131
V : TypeFoldable < ' tcx > + Lift < ' gcx > ,
@@ -147,7 +144,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
147
144
static_region : false ,
148
145
other_free_regions : true ,
149
146
} ,
150
- var_values
147
+ var_values,
151
148
)
152
149
}
153
150
}
@@ -192,8 +189,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
192
189
}
193
190
194
191
ty:: ReVar ( vid) => {
195
- let r = self
196
- . infcx
192
+ let r = self . infcx
197
193
. unwrap ( )
198
194
. borrow_region_constraints ( )
199
195
. opportunistic_resolve_var ( self . tcx , vid) ;
@@ -305,7 +301,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
305
301
infcx : Option < & ' cx InferCtxt < ' cx , ' gcx , ' tcx > > ,
306
302
tcx : TyCtxt < ' cx , ' gcx , ' tcx > ,
307
303
canonicalize_region_mode : CanonicalizeRegionMode ,
308
- var_values : & ' cx mut SmallCanonicalVarValues < ' tcx >
304
+ var_values : & ' cx mut SmallCanonicalVarValues < ' tcx > ,
309
305
) -> Canonicalized < ' gcx , V >
310
306
where
311
307
V : TypeFoldable < ' tcx > + Lift < ' gcx > ,
@@ -398,25 +394,23 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
398
394
// fill up `indices` to facilitate subsequent lookups.
399
395
if var_values. spilled ( ) {
400
396
assert ! ( indices. is_empty( ) ) ;
401
- * indices =
402
- var_values . iter ( )
403
- . enumerate ( )
404
- . map ( |( i, & kind) | ( kind, CanonicalVar :: new ( i) ) )
405
- . collect ( ) ;
397
+ * indices = var_values
398
+ . iter ( )
399
+ . enumerate ( )
400
+ . map ( |( i, & kind) | ( kind, CanonicalVar :: new ( i) ) )
401
+ . collect ( ) ;
406
402
}
407
403
// The cv is the index of the appended element.
408
404
CanonicalVar :: new ( var_values. len ( ) - 1 )
409
405
}
410
406
} else {
411
407
// `var_values` is large. Do a hashmap search via `indices`.
412
- * indices
413
- . entry ( kind)
414
- . or_insert_with ( || {
415
- variables. push ( info) ;
416
- var_values. push ( kind) ;
417
- assert_eq ! ( variables. len( ) , var_values. len( ) ) ;
418
- CanonicalVar :: new ( variables. len ( ) - 1 )
419
- } )
408
+ * indices. entry ( kind) . or_insert_with ( || {
409
+ variables. push ( info) ;
410
+ var_values. push ( kind) ;
411
+ assert_eq ! ( variables. len( ) , var_values. len( ) ) ;
412
+ CanonicalVar :: new ( variables. len ( ) - 1 )
413
+ } )
420
414
}
421
415
}
422
416
0 commit comments