@@ -34,7 +34,7 @@ use util::nodemap::FnvHashMap;
34
34
35
35
use serialize:: { self , Encodable , Encoder } ;
36
36
use std:: borrow:: Cow ;
37
- use std:: cell:: Cell ;
37
+ use std:: cell:: { Cell , RefCell } ;
38
38
use std:: hash:: { Hash , Hasher } ;
39
39
use std:: iter;
40
40
use std:: ops:: Deref ;
@@ -1220,6 +1220,12 @@ pub struct ParameterEnvironment<'tcx> {
1220
1220
/// regions don't have this implicit scope and instead introduce
1221
1221
/// relationships in the environment.
1222
1222
pub free_id_outlive : CodeExtent ,
1223
+
1224
+ /// A cache for `moves_by_default`.
1225
+ pub is_copy_cache : RefCell < FnvHashMap < Ty < ' tcx > , bool > > ,
1226
+
1227
+ /// A cache for `type_is_sized`
1228
+ pub is_sized_cache : RefCell < FnvHashMap < Ty < ' tcx > , bool > > ,
1223
1229
}
1224
1230
1225
1231
impl < ' a , ' tcx > ParameterEnvironment < ' tcx > {
@@ -1232,6 +1238,8 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
1232
1238
implicit_region_bound : self . implicit_region_bound ,
1233
1239
caller_bounds : caller_bounds,
1234
1240
free_id_outlive : self . free_id_outlive ,
1241
+ is_copy_cache : RefCell :: new ( FnvHashMap ( ) ) ,
1242
+ is_sized_cache : RefCell :: new ( FnvHashMap ( ) ) ,
1235
1243
}
1236
1244
}
1237
1245
@@ -2782,7 +2790,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2782
2790
free_substs : Substs :: empty ( self ) ,
2783
2791
caller_bounds : Vec :: new ( ) ,
2784
2792
implicit_region_bound : self . mk_region ( ty:: ReEmpty ) ,
2785
- free_id_outlive : free_id_outlive
2793
+ free_id_outlive : free_id_outlive,
2794
+ is_copy_cache : RefCell :: new ( FnvHashMap ( ) ) ,
2795
+ is_sized_cache : RefCell :: new ( FnvHashMap ( ) ) ,
2786
2796
}
2787
2797
}
2788
2798
@@ -2853,6 +2863,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2853
2863
implicit_region_bound : tcx. mk_region ( ty:: ReScope ( free_id_outlive) ) ,
2854
2864
caller_bounds : predicates,
2855
2865
free_id_outlive : free_id_outlive,
2866
+ is_copy_cache : RefCell :: new ( FnvHashMap ( ) ) ,
2867
+ is_sized_cache : RefCell :: new ( FnvHashMap ( ) ) ,
2856
2868
} ;
2857
2869
2858
2870
let cause = traits:: ObligationCause :: misc ( span, free_id_outlive. node_id ( & self . region_maps ) ) ;
0 commit comments