Skip to content

Commit 2f47a9e

Browse files
committed
Auto merge of rust-lang#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
2 parents cc6b88c + fc658f2 commit 2f47a9e

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
@@ -1750,7 +1750,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
17501750

17511751
let mut appears_in_output = AllCollector {
17521752
regions: FxHashSet(),
1753-
impl_trait: false
17541753
};
17551754
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
17561755

@@ -1763,7 +1762,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
17631762
// ignore binders here and scrape up all names we see.
17641763
let mut appears_in_where_clause = AllCollector {
17651764
regions: FxHashSet(),
1766-
impl_trait: false
17671765
};
17681766
for ty_param in generics.ty_params.iter() {
17691767
walk_list!(&mut appears_in_where_clause,
@@ -1804,9 +1802,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
18041802
// appears in the where clauses? early-bound.
18051803
if appears_in_where_clause.regions.contains(&name) { continue; }
18061804

1807-
// any `impl Trait` in the return type? early-bound.
1808-
if appears_in_output.impl_trait { continue; }
1809-
18101805
// does not appear in the inputs, but appears in the return type? early-bound.
18111806
if !constrained_by_input.regions.contains(&name) &&
18121807
appears_in_output.regions.contains(&name) {
@@ -1865,7 +1860,6 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
18651860

18661861
struct AllCollector {
18671862
regions: FxHashSet<hir::LifetimeName>,
1868-
impl_trait: bool
18691863
}
18701864

18711865
impl<'v> Visitor<'v> for AllCollector {
@@ -1876,12 +1870,5 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
18761870
fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
18771871
self.regions.insert(lifetime_ref.name);
18781872
}
1879-
1880-
fn visit_ty(&mut self, ty: &hir::Ty) {
1881-
if let hir::TyImplTraitExistential(..) = ty.node {
1882-
self.impl_trait = true;
1883-
}
1884-
intravisit::walk_ty(self, ty);
1885-
}
18861873
}
18871874
}

0 commit comments

Comments
 (0)