Skip to content

Commit fc658f2

Browse files
committed
rustc: don't mark lifetimes as early-bound in the presence of impl Trait.
1 parent 45594d5 commit fc658f2

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/librustc/middle/resolve_lifetime.rs

-13
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
16751675

16761676
let mut appears_in_output = AllCollector {
16771677
regions: FxHashSet(),
1678-
impl_trait: false
16791678
};
16801679
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
16811680

@@ -1688,7 +1687,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
16881687
// ignore binders here and scrape up all names we see.
16891688
let mut appears_in_where_clause = AllCollector {
16901689
regions: FxHashSet(),
1691-
impl_trait: false
16921690
};
16931691
for ty_param in generics.ty_params.iter() {
16941692
walk_list!(&mut appears_in_where_clause,
@@ -1729,9 +1727,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
17291727
// appears in the where clauses? early-bound.
17301728
if appears_in_where_clause.regions.contains(&name) { continue; }
17311729

1732-
// any `impl Trait` in the return type? early-bound.
1733-
if appears_in_output.impl_trait { continue; }
1734-
17351730
// does not appear in the inputs, but appears in the return type? early-bound.
17361731
if !constrained_by_input.regions.contains(&name) &&
17371732
appears_in_output.regions.contains(&name) {
@@ -1790,7 +1785,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
17901785

17911786
struct AllCollector {
17921787
regions: FxHashSet<hir::LifetimeName>,
1793-
impl_trait: bool
17941788
}
17951789

17961790
impl<'v> Visitor<'v> for AllCollector {
@@ -1801,12 +1795,5 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
18011795
fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
18021796
self.regions.insert(lifetime_ref.name);
18031797
}
1804-
1805-
fn visit_ty(&mut self, ty: &hir::Ty) {
1806-
if let hir::TyImplTraitExistential(..) = ty.node {
1807-
self.impl_trait = true;
1808-
}
1809-
intravisit::walk_ty(self, ty);
1810-
}
18111798
}
18121799
}

0 commit comments

Comments
 (0)