Skip to content

Commit 58f6cb4

Browse files
committed
Simplify visit_region implementation
1 parent 884053a commit 58f6cb4

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

compiler/rustc_ty_utils/src/instance.rs

+4-13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_trait_selection::traits;
99
use traits::{translate_substs, Reveal};
1010

1111
use rustc_data_structures::sso::SsoHashSet;
12+
use std::collections::btree_map::Entry;
1213
use std::collections::BTreeMap;
1314
use std::ops::ControlFlow;
1415

@@ -69,7 +70,6 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
6970
{
7071
return ControlFlow::CONTINUE;
7172
}
72-
use std::collections::btree_map::Entry;
7373
match *t.kind() {
7474
ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => {
7575
match self.vars.entry(bound_ty.var.as_u32()) {
@@ -90,27 +90,18 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
9090
}
9191

9292
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
93-
use std::collections::btree_map::Entry;
9493
match r {
95-
ty::ReLateBound(index, br) if *index == self.binder_index => match br.kind {
96-
ty::BrNamed(_def_id, _name) => {
97-
// FIXME
98-
}
99-
100-
ty::BrAnon(var) => match self.vars.entry(var) {
94+
ty::ReLateBound(index, br) if *index == self.binder_index => {
95+
match self.vars.entry(br.var.as_u32()) {
10196
Entry::Vacant(entry) => {
10297
entry.insert(ty::BoundVariableKind::Region(br.kind));
10398
}
10499
Entry::Occupied(entry) => match entry.get() {
105100
ty::BoundVariableKind::Region(_) => {}
106101
_ => bug!("Conflicting bound vars"),
107102
},
108-
},
109-
110-
ty::BrEnv => {
111-
// FIXME
112103
}
113-
},
104+
}
114105

115106
_ => (),
116107
};

compiler/rustc_typeck/src/check/wfcheck.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,6 @@ fn check_method_receiver<'fcx, 'tcx>(
10871087
debug!("check_method_receiver: sig={:?}", sig);
10881088

10891089
let self_ty = fcx.normalize_associated_types_in(span, self_ty);
1090-
let self_ty = fcx.tcx.liberate_late_bound_regions(method.def_id, ty::Binder::dummy(self_ty));
10911090

10921091
let receiver_ty = sig.inputs()[0];
10931092
let receiver_ty = fcx.normalize_associated_types_in(span, receiver_ty);

0 commit comments

Comments
 (0)