mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Flatten match.
This commit is contained in:
parent
c44e93086d
commit
ac03470c3b
@ -3076,50 +3076,54 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||||||
scope = s;
|
scope = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope::Elision { ref elide, ref s, .. } => {
|
Scope::Elision {
|
||||||
let lifetime = match *elide {
|
elide: Elide::FreshLateAnon(named_late_bound_vars, ref counter),
|
||||||
Elide::FreshLateAnon(named_late_bound_vars, ref counter) => {
|
..
|
||||||
for lifetime_ref in lifetime_refs {
|
} => {
|
||||||
let lifetime = Region::late_anon(named_late_bound_vars, counter)
|
for lifetime_ref in lifetime_refs {
|
||||||
.shifted(late_depth);
|
let lifetime =
|
||||||
|
Region::late_anon(named_late_bound_vars, counter).shifted(late_depth);
|
||||||
|
|
||||||
self.insert_lifetime(lifetime_ref, lifetime);
|
self.insert_lifetime(lifetime_ref, lifetime);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Elide::Exact(l) => l.shifted(late_depth),
|
|
||||||
Elide::Error(ref e) => {
|
Scope::Elision { elide: Elide::Exact(l), .. } => {
|
||||||
let mut scope = s;
|
let lifetime = l.shifted(late_depth);
|
||||||
loop {
|
|
||||||
match scope {
|
|
||||||
Scope::Binder { ref lifetimes, s, .. } => {
|
|
||||||
// Collect named lifetimes for suggestions.
|
|
||||||
for name in lifetimes.keys() {
|
|
||||||
if let hir::ParamName::Plain(name) = name {
|
|
||||||
lifetime_names.insert(name.name);
|
|
||||||
lifetime_spans.push(name.span);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scope = s;
|
|
||||||
}
|
|
||||||
Scope::ObjectLifetimeDefault { ref s, .. }
|
|
||||||
| Scope::Elision { ref s, .. }
|
|
||||||
| Scope::TraitRefBoundary { ref s, .. } => {
|
|
||||||
scope = s;
|
|
||||||
}
|
|
||||||
_ => break,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break Some(&e[..]);
|
|
||||||
}
|
|
||||||
Elide::Forbid => break None,
|
|
||||||
};
|
|
||||||
for lifetime_ref in lifetime_refs {
|
for lifetime_ref in lifetime_refs {
|
||||||
self.insert_lifetime(lifetime_ref, lifetime);
|
self.insert_lifetime(lifetime_ref, lifetime);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Scope::Elision { elide: Elide::Error(ref e), ref s, .. } => {
|
||||||
|
let mut scope = s;
|
||||||
|
loop {
|
||||||
|
match scope {
|
||||||
|
Scope::Binder { ref lifetimes, s, .. } => {
|
||||||
|
// Collect named lifetimes for suggestions.
|
||||||
|
for name in lifetimes.keys() {
|
||||||
|
if let hir::ParamName::Plain(name) = name {
|
||||||
|
lifetime_names.insert(name.name);
|
||||||
|
lifetime_spans.push(name.span);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
Scope::ObjectLifetimeDefault { ref s, .. }
|
||||||
|
| Scope::Elision { ref s, .. }
|
||||||
|
| Scope::TraitRefBoundary { ref s, .. } => {
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
_ => break,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break Some(&e[..]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Scope::Elision { elide: Elide::Forbid, .. } => break None,
|
||||||
|
|
||||||
Scope::ObjectLifetimeDefault { s, .. }
|
Scope::ObjectLifetimeDefault { s, .. }
|
||||||
| Scope::Supertrait { s, .. }
|
| Scope::Supertrait { s, .. }
|
||||||
| Scope::TraitRefBoundary { s, .. } => {
|
| Scope::TraitRefBoundary { s, .. } => {
|
||||||
|
Loading…
Reference in New Issue
Block a user