Skip late-bound lifetimes when crossing an AnonConst.
This commit is contained in:
parent
45d4465028
commit
a7f609504c
1 changed files with 12 additions and 2 deletions
|
@ -573,11 +573,17 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
|
||||||
// give, we will reverse the IndexMap after early captures.
|
// give, we will reverse the IndexMap after early captures.
|
||||||
let mut late_depth = 0;
|
let mut late_depth = 0;
|
||||||
let mut scope = self.scope;
|
let mut scope = self.scope;
|
||||||
|
let mut crossed_late_boundary = None;
|
||||||
let mut opaque_capture_scopes = vec![(opaque.def_id, &captures)];
|
let mut opaque_capture_scopes = vec![(opaque.def_id, &captures)];
|
||||||
loop {
|
loop {
|
||||||
match *scope {
|
match *scope {
|
||||||
Scope::Binder { ref bound_vars, scope_type, s, .. } => {
|
Scope::Binder { ref bound_vars, scope_type, s, .. } => {
|
||||||
for (&original_lifetime, &def) in bound_vars.iter().rev() {
|
for (&original_lifetime, &def) in bound_vars.iter().rev() {
|
||||||
|
if let ResolvedArg::LateBound(..) = def
|
||||||
|
&& crossed_late_boundary.is_some()
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if let DefKind::LifetimeParam = self.tcx.def_kind(original_lifetime) {
|
if let DefKind::LifetimeParam = self.tcx.def_kind(original_lifetime) {
|
||||||
let def = def.shifted(late_depth);
|
let def = def.shifted(late_depth);
|
||||||
let ident = lifetime_ident(original_lifetime);
|
let ident = lifetime_ident(original_lifetime);
|
||||||
|
@ -618,8 +624,12 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
|
||||||
|
|
||||||
Scope::ObjectLifetimeDefault { s, .. }
|
Scope::ObjectLifetimeDefault { s, .. }
|
||||||
| Scope::Supertrait { s, .. }
|
| Scope::Supertrait { s, .. }
|
||||||
| Scope::TraitRefBoundary { s, .. }
|
| Scope::TraitRefBoundary { s, .. } => {
|
||||||
| Scope::LateBoundary { s, .. } => {
|
scope = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scope::LateBoundary { s, what, .. } => {
|
||||||
|
crossed_late_boundary = Some(what);
|
||||||
scope = s;
|
scope = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue