about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2018-04-20 11:46:18 -0500
committerTyler Mandry <tmandry@gmail.com>2018-04-24 22:12:07 -0500
commit9ffe9bea53ac6dfb1bc1b23b22fbe1c5fafcfe8c (patch)
tree070835214a9fd1059feddcd7dac3a878b77ee2aa
parent98546f8b265c7d8dc2346d8bfce3d277dbc3fd5d (diff)
downloadrust-9ffe9bea53ac6dfb1bc1b23b22fbe1c5fafcfe8c.tar.gz
rust-9ffe9bea53ac6dfb1bc1b23b22fbe1c5fafcfe8c.zip
Remove methods with implicit Binder::skip_bound
Fixes #20664.
-rw-r--r--src/librustc/traits/mod.rs11
-rw-r--r--src/librustc/traits/select.rs3
-rw-r--r--src/librustc/ty/sty.rs15
-rw-r--r--src/librustc_typeck/check/closure.rs2
-rw-r--r--src/librustc_typeck/check/method/probe.rs2
5 files changed, 11 insertions, 22 deletions
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index 9e636db3a76..728d9f1a027 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -855,16 +855,19 @@ fn vtable_methods<'a, 'tcx>(
 
                 // the method may have some early-bound lifetimes, add
                 // regions for those
-                let substs = Substs::for_item(tcx, def_id,
-                                              |_, _| tcx.types.re_erased,
-                                              |def, _| trait_ref.substs().type_for_def(def));
+                let substs = trait_ref.map_bound(|trait_ref| {
+                    Substs::for_item(
+                        tcx, def_id,
+                        |_, _| tcx.types.re_erased,
+                        |def, _| trait_ref.substs.type_for_def(def))
+                });
 
                 // the trait type may have higher-ranked lifetimes in it;
                 // so erase them if they appear, so that we get the type
                 // at some particular call site
                 let substs = tcx.normalize_erasing_late_bound_regions(
                     ty::ParamEnv::reveal_all(),
-                    &ty::Binder::bind(substs),
+                    &substs
                 );
 
                 // It's possible that the method relies on where clauses that
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs
index b61407ffdb6..cfc14b7bfe4 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -786,7 +786,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
         // This suffices to allow chains like `FnMut` implemented in
         // terms of `Fn` etc, but we could probably make this more
         // precise still.
-        let unbound_input_types = stack.fresh_trait_ref.input_types().any(|ty| ty.is_fresh());
+        let unbound_input_types =
+            stack.fresh_trait_ref.skip_binder().input_types().any(|ty| ty.is_fresh());
         // this check was an imperfect workaround for a bug n the old
         // intercrate mode, it should be removed when that goes away.
         if unbound_input_types &&
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index d5b63939dd6..92e879a584b 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -574,16 +574,6 @@ impl<'tcx> PolyTraitRef<'tcx> {
         self.skip_binder().def_id
     }
 
-    pub fn substs(&self) -> &'tcx Substs<'tcx> {
-        // FIXME(#20664) every use of this fn is probably a bug, it should yield Binder<>
-        self.skip_binder().substs
-    }
-
-    pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
-        // FIXME(#20664) every use of this fn is probably a bug, it should yield Binder<>
-        self.skip_binder().input_types()
-    }
-
     pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> {
         // Note that we preserve binding levels
         Binder(ty::TraitPredicate { trait_ref: self.skip_binder().clone() })
@@ -635,11 +625,6 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> {
     pub fn def_id(&self) -> DefId {
         self.skip_binder().def_id
     }
-
-    pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
-        // FIXME(#20664) every use of this fn is probably a bug, it should yield Binder<>
-        self.skip_binder().input_types()
-    }
 }
 
 /// Binder is a binder for higher-ranked lifetimes. It is part of the
diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs
index 0deda993d4f..ed0613860d0 100644
--- a/src/librustc_typeck/check/closure.rs
+++ b/src/librustc_typeck/check/closure.rs
@@ -303,7 +303,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             return None;
         }
 
-        let arg_param_ty = trait_ref.substs().type_at(1);
+        let arg_param_ty = trait_ref.skip_binder().substs.type_at(1);
         let arg_param_ty = self.resolve_type_vars_if_possible(&arg_param_ty);
         debug!(
             "deduce_sig_from_projection: arg_param_ty {:?}",
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 5c1ca44f9f5..b41a6dcf384 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -1485,7 +1485,7 @@ impl<'tcx> Candidate<'tcx> {
                     // inference variables or other artifacts. This
                     // means they are safe to put into the
                     // `WhereClausePick`.
-                    assert!(!trait_ref.substs().needs_infer());
+                    assert!(!trait_ref.skip_binder().substs.needs_infer());
 
                     WhereClausePick(trait_ref.clone())
                 }