Correct visit_region
implementation
This commit is contained in:
parent
13e116f1f7
commit
e28a93365a
@ -39,7 +39,7 @@ fn new() -> Self {
|
||||
}
|
||||
|
||||
fn into_vars(self, tcx: TyCtxt<'tcx>) -> &'tcx ty::List<ty::BoundVariableKind> {
|
||||
let max = self.vars.iter().map(|(k, _)| *k).max().unwrap_or_else(|| 0);
|
||||
let max = self.vars.iter().map(|(k, _)| *k).max().unwrap_or(0);
|
||||
for i in 0..max {
|
||||
if let None = self.vars.get(&i) {
|
||||
panic!("Unknown variable: {:?}", i);
|
||||
@ -90,6 +90,31 @@ fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
}
|
||||
|
||||
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) {
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(ty::BoundVariableKind::Region(br.kind));
|
||||
}
|
||||
Entry::Occupied(entry) => match entry.get() {
|
||||
ty::BoundVariableKind::Region(_) => {}
|
||||
_ => bug!("Conflicting bound vars"),
|
||||
},
|
||||
},
|
||||
|
||||
ty::BrEnv => {
|
||||
// FIXME
|
||||
}
|
||||
},
|
||||
|
||||
_ => (),
|
||||
};
|
||||
|
||||
r.super_visit_with(self)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user