about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-25 14:28:20 +0000
committerbors <bors@rust-lang.org>2017-11-25 14:28:20 +0000
commit2f47a9eb80bc3474b6e89637269ef1f92cfccb7f (patch)
treec6e9b327f8f36c06111c56a4143520c465472462
parentcc6b88ccb2fd10c2ad04a30ba648a1e9abf7ba4b (diff)
parentfc658f2cfdb0c53b028d85bb540b9cb83eb7df91 (diff)
downloadrust-2f47a9eb80bc3474b6e89637269ef1f92cfccb7f.tar.gz
rust-2f47a9eb80bc3474b6e89637269ef1f92cfccb7f.zip
Auto merge of #46191 - eddyb:better-late-than-never, r=nikomatsakis
rustc: don't mark lifetimes as early-bound in the presence of impl Trait.

This hack from the original implementation shouldn't be needed anymore, thanks to @cramertj.

r? @nikomatsakis
-rw-r--r--src/librustc/middle/resolve_lifetime.rs13
1 files changed, 0 insertions, 13 deletions
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index b39975d3ff9..4856fa3fc45 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -1750,7 +1750,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);
 
@@ -1763,7 +1762,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,
@@ -1804,9 +1802,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) {
@@ -1865,7 +1860,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
 
     struct AllCollector {
         regions: FxHashSet<hir::LifetimeName>,
-        impl_trait: bool
     }
 
     impl<'v> Visitor<'v> for AllCollector {
@@ -1876,12 +1870,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);
-        }
     }
 }