Skip to content

Commit

Permalink
Use Set1<Region> instead of Option<Region>
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jul 27, 2019
1 parent 7b9a65e commit 2f64404
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/librustc/middle/resolve_lifetime.rs
Expand Up @@ -2149,7 +2149,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
struct SelfVisitor<'a> {
map: &'a NamedRegionMap,
impl_self: Option<&'a hir::TyKind>,
lifetime: Option<Region>,
lifetime: Set1<Region>,
}

impl SelfVisitor<'_> {
Expand Down Expand Up @@ -2193,8 +2193,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node
{
if self.is_self_ty(path.res) {
self.lifetime = self.map.defs.get(&lifetime_ref.hir_id).copied();
return;
if let Some(lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
self.lifetime.insert(*lifetime);
}
}
}
}
Expand All @@ -2205,10 +2206,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
let mut visitor = SelfVisitor {
map: self.map,
impl_self: impl_self.map(|ty| &ty.node),
lifetime: None,
lifetime: Set1::Empty,
};
visitor.visit_ty(&inputs[0]);
if let Some(lifetime) = visitor.lifetime {
if let Set1::One(lifetime) = visitor.lifetime {
let scope = Scope::Elision {
elide: Elide::Exact(lifetime),
s: self.scope,
Expand Down

0 comments on commit 2f64404

Please sign in to comment.