X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Ftraits%2Ftrans%2Fmod.rs;h=3bc8a65df1c1482d35553754533ff50c26e1be37;hb=77d3ca1bad2f99fe9a0691551c5524fcc290a406;hp=827a5092c00420e6a5c47355e2caad3b7d3fbd9d;hpb=c2009536acd2a0fb6277d7b6d9a835d17cab97ca;p=rust.git diff --git a/src/librustc/traits/trans/mod.rs b/src/librustc/traits/trans/mod.rs index 827a5092c00..3bc8a65df1c 100644 --- a/src/librustc/traits/trans/mod.rs +++ b/src/librustc/traits/trans/mod.rs @@ -38,17 +38,17 @@ pub fn trans_fulfill_obligation(self, { // Remove any references to regions; this helps improve caching. let trait_ref = self.erase_regions(&trait_ref); + let param_env = ty::ParamEnv::empty(Reveal::All); - self.trans_trait_caches.trait_cache.memoize(trait_ref, || { + self.trans_trait_caches.trait_cache.memoize((param_env, trait_ref), || { debug!("trans::fulfill_obligation(trait_ref={:?}, def_id={:?})", - trait_ref, trait_ref.def_id()); + (param_env, trait_ref), trait_ref.def_id()); // Do the initial selection for the obligation. This yields the // shallow result we are looking for -- that is, what specific impl. self.infer_ctxt().enter(|infcx| { let mut selcx = SelectionContext::new(&infcx); - let param_env = ty::ParamEnv::empty(Reveal::All); let obligation_cause = ObligationCause::misc(span, ast::DUMMY_NODE_ID); let obligation = Obligation::new(obligation_cause, @@ -120,7 +120,7 @@ fn new(tcx: TyCtxt<'a, 'gcx, 'gcx>) -> Self { } fn fold>(&mut self, value: &T) -> T { - if !value.has_projection_types() { + if !value.has_projections() { value.clone() } else { value.fold_with(self) @@ -134,7 +134,7 @@ fn tcx<'c>(&'c self) -> TyCtxt<'c, 'gcx, 'gcx> { } fn fold_ty(&mut self, ty: Ty<'gcx>) -> Ty<'gcx> { - if !ty.has_projection_types() { + if !ty.has_projections() { ty } else { self.tcx.trans_trait_caches.project_cache.memoize(ty, || { @@ -167,7 +167,7 @@ pub struct TraitSelectionCache<'tcx> { } impl<'tcx> DepTrackingMapConfig for TraitSelectionCache<'tcx> { - type Key = ty::PolyTraitRef<'tcx>; + type Key = (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>); type Value = Vtable<'tcx, ()>; fn to_dep_kind() -> DepKind { DepKind::TraitSelect