From 58f6cb4557b2d63d311420bbf6bc63aa119f8306 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sat, 3 Jul 2021 02:13:17 +0900 Subject: Simplify `visit_region` implementation --- compiler/rustc_ty_utils/src/instance.rs | 17 ++++------------- compiler/rustc_typeck/src/check/wfcheck.rs | 1 - 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 { - 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); -- cgit 1.4.1-3-g733a5