Skip to content

Commit 77d3ca1

Browse files
committed
add ParamEnv to the trait_cache key
1 parent dcb4378 commit 77d3ca1

File tree

1 file changed

+4
-4
lines changed
  • src/librustc/traits/trans

1 file changed

+4
-4
lines changed

src/librustc/traits/trans/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
3838
{
3939
// Remove any references to regions; this helps improve caching.
4040
let trait_ref = self.erase_regions(&trait_ref);
41+
let param_env = ty::ParamEnv::empty(Reveal::All);
4142

42-
self.trans_trait_caches.trait_cache.memoize(trait_ref, || {
43+
self.trans_trait_caches.trait_cache.memoize((param_env, trait_ref), || {
4344
debug!("trans::fulfill_obligation(trait_ref={:?}, def_id={:?})",
44-
trait_ref, trait_ref.def_id());
45+
(param_env, trait_ref), trait_ref.def_id());
4546

4647
// Do the initial selection for the obligation. This yields the
4748
// shallow result we are looking for -- that is, what specific impl.
4849
self.infer_ctxt().enter(|infcx| {
4950
let mut selcx = SelectionContext::new(&infcx);
5051

51-
let param_env = ty::ParamEnv::empty(Reveal::All);
5252
let obligation_cause = ObligationCause::misc(span,
5353
ast::DUMMY_NODE_ID);
5454
let obligation = Obligation::new(obligation_cause,
@@ -167,7 +167,7 @@ pub struct TraitSelectionCache<'tcx> {
167167
}
168168

169169
impl<'tcx> DepTrackingMapConfig for TraitSelectionCache<'tcx> {
170-
type Key = ty::PolyTraitRef<'tcx>;
170+
type Key = (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>);
171171
type Value = Vtable<'tcx, ()>;
172172
fn to_dep_kind() -> DepKind {
173173
DepKind::TraitSelect

0 commit comments

Comments
 (0)