diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-11-22 21:10:55 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-11-22 21:10:55 +0200 |
| commit | fc658f2cfdb0c53b028d85bb540b9cb83eb7df91 (patch) | |
| tree | 64429baf291c52071d56c0db7e7900452458e94c | |
| parent | 45594d5dec4237f49e794a2a854a69f50b63d31e (diff) | |
| download | rust-fc658f2cfdb0c53b028d85bb540b9cb83eb7df91.tar.gz rust-fc658f2cfdb0c53b028d85bb540b9cb83eb7df91.zip | |
rustc: don't mark lifetimes as early-bound in the presence of impl Trait.
| -rw-r--r-- | src/librustc/middle/resolve_lifetime.rs | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 7ed646bb9dd..fa6f3826ac5 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1675,7 +1675,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap, let mut appears_in_output = AllCollector { regions: FxHashSet(), - impl_trait: false }; intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output); @@ -1688,7 +1687,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap, // ignore binders here and scrape up all names we see. let mut appears_in_where_clause = AllCollector { regions: FxHashSet(), - impl_trait: false }; for ty_param in generics.ty_params.iter() { walk_list!(&mut appears_in_where_clause, @@ -1729,9 +1727,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap, // appears in the where clauses? early-bound. if appears_in_where_clause.regions.contains(&name) { continue; } - // any `impl Trait` in the return type? early-bound. - if appears_in_output.impl_trait { continue; } - // does not appear in the inputs, but appears in the return type? early-bound. if !constrained_by_input.regions.contains(&name) && appears_in_output.regions.contains(&name) { @@ -1790,7 +1785,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap, struct AllCollector { regions: FxHashSet<hir::LifetimeName>, - impl_trait: bool } impl<'v> Visitor<'v> for AllCollector { @@ -1801,12 +1795,5 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap, fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) { self.regions.insert(lifetime_ref.name); } - - fn visit_ty(&mut self, ty: &hir::Ty) { - if let hir::TyImplTraitExistential(..) = ty.node { - self.impl_trait = true; - } - intravisit::walk_ty(self, ty); - } } } |
