@@ -34,7 +34,7 @@ use util::nodemap::FnvHashMap;
3434
3535use serialize:: { self , Encodable , Encoder } ;
3636use std:: borrow:: Cow ;
37- use std:: cell:: Cell ;
37+ use std:: cell:: { Cell , RefCell } ;
3838use std:: hash:: { Hash , Hasher } ;
3939use std:: iter;
4040use std:: ops:: Deref ;
@@ -1220,6 +1220,12 @@ pub struct ParameterEnvironment<'tcx> {
12201220 /// regions don't have this implicit scope and instead introduce
12211221 /// relationships in the environment.
12221222 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 > > ,
12231229}
12241230
12251231impl < ' a , ' tcx > ParameterEnvironment < ' tcx > {
@@ -1232,6 +1238,8 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12321238 implicit_region_bound : self . implicit_region_bound ,
12331239 caller_bounds : caller_bounds,
12341240 free_id_outlive : self . free_id_outlive ,
1241+ is_copy_cache : RefCell :: new ( FnvHashMap ( ) ) ,
1242+ is_sized_cache : RefCell :: new ( FnvHashMap ( ) ) ,
12351243 }
12361244 }
12371245
@@ -2782,7 +2790,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
27822790 free_substs : Substs :: empty ( self ) ,
27832791 caller_bounds : Vec :: new ( ) ,
27842792 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 ( ) ) ,
27862796 }
27872797 }
27882798
@@ -2853,6 +2863,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
28532863 implicit_region_bound : tcx. mk_region ( ty:: ReScope ( free_id_outlive) ) ,
28542864 caller_bounds : predicates,
28552865 free_id_outlive : free_id_outlive,
2866+ is_copy_cache : RefCell :: new ( FnvHashMap ( ) ) ,
2867+ is_sized_cache : RefCell :: new ( FnvHashMap ( ) ) ,
28562868 } ;
28572869
28582870 let cause = traits:: ObligationCause :: misc ( span, free_id_outlive. node_id ( & self . region_maps ) ) ;
0 commit comments