Flatten match.

This commit is contained in:
Camille GILLOT 2021-10-31 17:21:32 +01:00
parent c44e93086d
commit ac03470c3b

View File

@ -3076,19 +3076,28 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
scope = s;
}
Scope::Elision { ref elide, ref s, .. } => {
let lifetime = match *elide {
Elide::FreshLateAnon(named_late_bound_vars, ref counter) => {
Scope::Elision {
elide: Elide::FreshLateAnon(named_late_bound_vars, ref counter),
..
} => {
for lifetime_ref in lifetime_refs {
let lifetime = Region::late_anon(named_late_bound_vars, counter)
.shifted(late_depth);
let lifetime =
Region::late_anon(named_late_bound_vars, counter).shifted(late_depth);
self.insert_lifetime(lifetime_ref, lifetime);
}
return;
}
Elide::Exact(l) => l.shifted(late_depth),
Elide::Error(ref e) => {
Scope::Elision { elide: Elide::Exact(l), .. } => {
let lifetime = l.shifted(late_depth);
for lifetime_ref in lifetime_refs {
self.insert_lifetime(lifetime_ref, lifetime);
}
return;
}
Scope::Elision { elide: Elide::Error(ref e), ref s, .. } => {
let mut scope = s;
loop {
match scope {
@ -3112,13 +3121,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}
break Some(&e[..]);
}
Elide::Forbid => break None,
};
for lifetime_ref in lifetime_refs {
self.insert_lifetime(lifetime_ref, lifetime);
}
return;
}
Scope::Elision { elide: Elide::Forbid, .. } => break None,
Scope::ObjectLifetimeDefault { s, .. }
| Scope::Supertrait { s, .. }