about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits/project.rs
diff options
context:
space:
mode:
authorJack Huey <jack.huey@umassmed.edu>2020-10-07 20:02:06 -0400
committerJack Huey <jack.huey@umassmed.edu>2020-10-16 12:58:50 -0400
commitdd5c9bf1392bdc697740e62a1924b7942cdfd86a (patch)
treed98fd43351d17cd47664b76ec663a250f534cc23 /compiler/rustc_trait_selection/src/traits/project.rs
parenta78a62fc996ba16f7a111c99520b23f77029f4eb (diff)
Use map_bound(_ref) instead of Binder::bind when possible
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/project.rs')
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index 8dbf7ec51c6..295ba6041fb 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -623,7 +623,8 @@ fn prune_cache_value_obligations<'a, 'tcx>(
         .obligations
         .iter()
         .filter(|obligation| {
-            match obligation.predicate.skip_binders() {
+            let bound_predicate = obligation.predicate.bound_atom(infcx.tcx);
+            match bound_predicate.skip_binder() {
                 // We found a `T: Foo<X = U>` predicate, let's check
                 // if `U` references any unresolved type
                 // variables. In principle, we only care if this
@@ -633,9 +634,9 @@ fn prune_cache_value_obligations<'a, 'tcx>(
                 // indirect obligations (e.g., we project to `?0`,
                 // but we have `T: Foo<X = ?1>` and `?1: Bar<X =
                 // ?0>`).
-                ty::PredicateAtom::Projection(data) => {
-                    infcx.unresolved_type_vars(&ty::Binder::bind(data.ty)).is_some()
-                }
+                ty::PredicateAtom::Projection(data) => infcx
+                    .unresolved_type_vars(&bound_predicate.map_bound_ref(|_| data.ty))
+                    .is_some(),
 
                 // We are only interested in `T: Foo<X = U>` predicates, whre
                 // `U` references one of `unresolved_type_vars`. =)
@@ -907,8 +908,9 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
     let infcx = selcx.infcx();
     for predicate in env_predicates {
         debug!(?predicate);
+        let bound_predicate = predicate.bound_atom(infcx.tcx);
         if let ty::PredicateAtom::Projection(data) = predicate.skip_binders() {
-            let data = ty::Binder::bind(data);
+            let data = bound_predicate.map_bound_ref(|_| data);
             let same_def_id = data.projection_def_id() == obligation.predicate.item_def_id;
 
             let is_match = same_def_id