about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <yuki.okushi@huawei.com>2021-07-03 02:13:17 +0900
committerYuki Okushi <yuki.okushi@huawei.com>2021-07-03 02:21:19 +0900
commit58f6cb4557b2d63d311420bbf6bc63aa119f8306 (patch)
treeb662ce82c78a04691f862a8fd7dad2ff427e6ba0
parent884053a4b422e63a78eddd7b49793c32020d321b (diff)
downloadrust-58f6cb4557b2d63d311420bbf6bc63aa119f8306.tar.gz
rust-58f6cb4557b2d63d311420bbf6bc63aa119f8306.zip
Simplify `visit_region` implementation
-rw-r--r--compiler/rustc_ty_utils/src/instance.rs17
-rw-r--r--compiler/rustc_typeck/src/check/wfcheck.rs1
2 files changed, 4 insertions, 14 deletions
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs
index 0f507cfb997..469ac04e545 100644
--- a/compiler/rustc_ty_utils/src/instance.rs
+++ b/compiler/rustc_ty_utils/src/instance.rs
@@ -9,6 +9,7 @@ use rustc_trait_selection::traits;
 use traits::{translate_substs, Reveal};
 
 use rustc_data_structures::sso::SsoHashSet;
+use std::collections::btree_map::Entry;
 use std::collections::BTreeMap;
 use std::ops::ControlFlow;
 
@@ -69,7 +70,6 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
         {
             return ControlFlow::CONTINUE;
         }
-        use std::collections::btree_map::Entry;
         match *t.kind() {
             ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => {
                 match self.vars.entry(bound_ty.var.as_u32()) {
@@ -90,14 +90,9 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
     }
 
     fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
-        use std::collections::btree_map::Entry;
         match r {
-            ty::ReLateBound(index, br) if *index == self.binder_index => match br.kind {
-                ty::BrNamed(_def_id, _name) => {
-                    // FIXME
-                }
-
-                ty::BrAnon(var) => match self.vars.entry(var) {
+            ty::ReLateBound(index, br) if *index == self.binder_index => {
+                match self.vars.entry(br.var.as_u32()) {
                     Entry::Vacant(entry) => {
                         entry.insert(ty::BoundVariableKind::Region(br.kind));
                     }
@@ -105,12 +100,8 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
                         ty::BoundVariableKind::Region(_) => {}
                         _ => bug!("Conflicting bound vars"),
                     },
-                },
-
-                ty::BrEnv => {
-                    // FIXME
                 }
-            },
+            }
 
             _ => (),
         };
diff --git a/compiler/rustc_typeck/src/check/wfcheck.rs b/compiler/rustc_typeck/src/check/wfcheck.rs
index dae11262189..0e063c86f2f 100644
--- a/compiler/rustc_typeck/src/check/wfcheck.rs
+++ b/compiler/rustc_typeck/src/check/wfcheck.rs
@@ -1087,7 +1087,6 @@ fn check_method_receiver<'fcx, 'tcx>(
     debug!("check_method_receiver: sig={:?}", sig);
 
     let self_ty = fcx.normalize_associated_types_in(span, self_ty);
-    let self_ty = fcx.tcx.liberate_late_bound_regions(method.def_id, ty::Binder::dummy(self_ty));
 
     let receiver_ty = sig.inputs()[0];
     let receiver_ty = fcx.normalize_associated_types_in(span, receiver_ty);