use serialize::{self, Encodable, Encoder};
use std::borrow::Cow;
- use std::cell::Cell;
+ use std::cell::{Cell, RefCell};
use std::hash::{Hash, Hasher};
use std::iter;
use std::ops::Deref;
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
-/// A wrapper for slices with the additioanl invariant
+/// A wrapper for slices with the additional invariant
/// that the slice is interned and no other slice with
/// the same contents can exist in the same context.
/// This means we can use pointer + length for both
/// regions don't have this implicit scope and instead introduce
/// relationships in the environment.
pub free_id_outlive: CodeExtent,
+
+ /// A cache for `moves_by_default`.
+ pub is_copy_cache: RefCell<FnvHashMap<Ty<'tcx>, bool>>,
+
+ /// A cache for `type_is_sized`
+ pub is_sized_cache: RefCell<FnvHashMap<Ty<'tcx>, bool>>,
}
impl<'a, 'tcx> ParameterEnvironment<'tcx> {
implicit_region_bound: self.implicit_region_bound,
caller_bounds: caller_bounds,
free_id_outlive: self.free_id_outlive,
+ is_copy_cache: RefCell::new(FnvHashMap()),
+ is_sized_cache: RefCell::new(FnvHashMap()),
}
}
free_substs: Substs::empty(self),
caller_bounds: Vec::new(),
implicit_region_bound: self.mk_region(ty::ReEmpty),
- free_id_outlive: free_id_outlive
+ free_id_outlive: free_id_outlive,
+ is_copy_cache: RefCell::new(FnvHashMap()),
+ is_sized_cache: RefCell::new(FnvHashMap()),
}
}
implicit_region_bound: tcx.mk_region(ty::ReScope(free_id_outlive)),
caller_bounds: predicates,
free_id_outlive: free_id_outlive,
+ is_copy_cache: RefCell::new(FnvHashMap()),
+ is_sized_cache: RefCell::new(FnvHashMap()),
};
let cause = traits::ObligationCause::misc(span, free_id_outlive.node_id(&self.region_maps));
use hir::def_id::{DefId, LOCAL_CRATE};
use hir::pat_util;
use rustc::infer::{self, InferCtxt, InferOk, TypeOrigin, TypeTrace, type_variable};
-use rustc::ty::subst::{Subst, Substs};
+use rustc::ty::subst::{Kind, Subst, Substs};
use rustc::traits::{self, Reveal};
use rustc::ty::{ParamTy, ParameterEnvironment};
use rustc::ty::{LvaluePreference, NoPreference, PreferMutLvalue};
fn ty_infer_for_def(&self,
ty_param_def: &ty::TypeParameterDef<'tcx>,
- substs: &Substs<'tcx>,
+ substs: &[Kind<'tcx>],
span: Span) -> Ty<'tcx> {
self.type_var_for_def(span, ty_param_def, substs)
}
}
}
- pub fn param_env(&self) -> &ty::ParameterEnvironment<'tcx> {
+ pub fn param_env(&self) -> &ty::ParameterEnvironment<'gcx> {
&self.parameter_environment
}