Remove index from BrAnon
This commit is contained in:
parent
e4edf00f12
commit
f0edcc8a6f
33 changed files with 68 additions and 88 deletions
|
@ -730,7 +730,7 @@ fn bound_vars_for_item(tcx: TyCtxt<'_>, def_id: DefId) -> SubstsRef<'_> {
|
|||
ty::GenericParamDefKind::Lifetime => {
|
||||
let br = ty::BoundRegion {
|
||||
var: ty::BoundVar::from_usize(substs.len()),
|
||||
kind: ty::BrAnon(substs.len() as u32, None),
|
||||
kind: ty::BrAnon(None),
|
||||
};
|
||||
tcx.mk_re_late_bound(ty::INNERMOST, br).into()
|
||||
}
|
||||
|
|
|
@ -533,7 +533,7 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
|
|||
ty::DebruijnIndex::from_u32(var.debruijn.depth()),
|
||||
ty::BoundRegion {
|
||||
var: ty::BoundVar::from_usize(var.index),
|
||||
kind: ty::BrAnon(var.index as u32, None),
|
||||
kind: ty::BrAnon(None),
|
||||
},
|
||||
),
|
||||
chalk_ir::LifetimeData::InferenceVar(_var) => unimplemented!(),
|
||||
|
@ -541,7 +541,7 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
|
|||
universe: ty::UniverseIndex::from_usize(p.ui.counter),
|
||||
bound: ty::BoundRegion {
|
||||
var: ty::BoundVar::from_usize(p.idx),
|
||||
kind: ty::BoundRegionKind::BrAnon(p.idx as u32, None),
|
||||
kind: ty::BoundRegionKind::BrAnon(None),
|
||||
},
|
||||
}),
|
||||
chalk_ir::LifetimeData::Static => tcx.lifetimes.re_static,
|
||||
|
@ -976,7 +976,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for BoundVarsCollector<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ty::BoundRegionKind::BrAnon(var, _) => match self.parameters.entry(var) {
|
||||
ty::BoundRegionKind::BrAnon(_) => match self.parameters.entry(br.var.as_u32()) {
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(chalk_ir::VariableKind::Lifetime);
|
||||
}
|
||||
|
@ -1036,8 +1036,8 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for NamedBoundVarSubstitutor<'a, 'tcx> {
|
|||
match *r {
|
||||
ty::ReLateBound(index, br) if index == self.binder_index => match br.kind {
|
||||
ty::BrNamed(def_id, _name) => match self.named_parameters.get(&def_id) {
|
||||
Some(idx) => {
|
||||
let new_br = ty::BoundRegion { var: br.var, kind: ty::BrAnon(*idx, None) };
|
||||
Some(_) => {
|
||||
let new_br = ty::BoundRegion { var: br.var, kind: ty::BrAnon(None) };
|
||||
return self.tcx.mk_re_late_bound(index, new_br);
|
||||
}
|
||||
None => panic!("Missing `BrNamed`."),
|
||||
|
@ -1127,7 +1127,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamsSubstitutor<'tcx> {
|
|||
Some(idx) => {
|
||||
let br = ty::BoundRegion {
|
||||
var: ty::BoundVar::from_u32(*idx),
|
||||
kind: ty::BrAnon(*idx, None),
|
||||
kind: ty::BrAnon(None),
|
||||
};
|
||||
self.tcx.mk_re_late_bound(self.binder_index, br)
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamsSubstitutor<'tcx> {
|
|||
let idx = self.named_regions.len() as u32;
|
||||
let br = ty::BoundRegion {
|
||||
var: ty::BoundVar::from_u32(idx),
|
||||
kind: ty::BrAnon(idx, None),
|
||||
kind: ty::BrAnon(None),
|
||||
};
|
||||
self.named_regions.insert(_re.def_id, idx);
|
||||
self.tcx.mk_re_late_bound(self.binder_index, br)
|
||||
|
@ -1213,8 +1213,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for PlaceholdersCollector {
|
|||
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match *r {
|
||||
ty::RePlaceholder(p) if p.universe == self.universe_index => {
|
||||
if let ty::BoundRegionKind::BrAnon(anon, _) = p.bound.kind {
|
||||
self.next_anon_region_placeholder = self.next_anon_region_placeholder.max(anon);
|
||||
if let ty::BoundRegionKind::BrAnon(_) = p.bound.kind {
|
||||
self.next_anon_region_placeholder =
|
||||
self.next_anon_region_placeholder.max(p.bound.var.as_u32());
|
||||
}
|
||||
// FIXME: This doesn't seem to handle BrNamed at all?
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue