Make late and late_anon regions track the bound var position
This commit is contained in:
parent
84f82d348c
commit
666859a6f8
6 changed files with 99 additions and 54 deletions
|
@ -210,14 +210,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
let r = match tcx.named_region(lifetime.hir_id) {
|
||||
Some(rl::Region::Static) => tcx.lifetimes.re_static,
|
||||
|
||||
Some(rl::Region::LateBound(debruijn, id, _)) => {
|
||||
Some(rl::Region::LateBound(debruijn, _, id, _)) => {
|
||||
let name = lifetime_name(id.expect_local());
|
||||
let br = ty::BoundRegion { kind: ty::BrNamed(id, name) };
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
}
|
||||
|
||||
Some(rl::Region::LateBoundAnon(debruijn, index)) => {
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(index) };
|
||||
Some(rl::Region::LateBoundAnon(debruijn, _index, anon_index)) => {
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(anon_index) };
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
}
|
||||
|
||||
|
|
|
@ -1244,7 +1244,8 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
|||
match self.tcx.named_region(lt.hir_id) {
|
||||
Some(rl::Region::Static | rl::Region::EarlyBound(..)) => {}
|
||||
Some(
|
||||
rl::Region::LateBound(debruijn, _, _) | rl::Region::LateBoundAnon(debruijn, _),
|
||||
rl::Region::LateBound(debruijn, _, _, _)
|
||||
| rl::Region::LateBoundAnon(debruijn, _, _),
|
||||
) if debruijn < self.outer_index => {}
|
||||
Some(
|
||||
rl::Region::LateBound(..)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue