Skip to content

Commit 9f28de5

Browse files
Free late-bound lifetimes in closures as well
1 parent 5ab7445 commit 9f28de5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/rustc_hir_analysis/src/collect/lifetimes.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,11 +1377,12 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
13771377
} else if let Some(body_id) = outermost_body {
13781378
let fn_id = self.tcx.hir().body_owner(body_id);
13791379
match self.tcx.hir().get(fn_id) {
1380-
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(..), .. })
1381-
| Node::TraitItem(&hir::TraitItem {
1380+
Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. })
1381+
| Node::TraitItem(hir::TraitItem {
13821382
kind: hir::TraitItemKind::Fn(..), ..
13831383
})
1384-
| Node::ImplItem(&hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }) => {
1384+
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. })
1385+
| Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => {
13851386
let scope = self.tcx.hir().local_def_id(fn_id);
13861387
def = Region::Free(scope.to_def_id(), def.id().unwrap());
13871388
}

0 commit comments

Comments
 (0)