diff options
| author | Michael Goulet <michael@errs.io> | 2022-10-30 20:51:01 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-10-31 01:47:19 +0000 |
| commit | 9f28de513a309af7593e8959f92ec11e07ea255f (patch) | |
| tree | dfe7dee03d0e5a8c30ccab62bda132d8e4d82712 | |
| parent | 5ab74459b86465e751fc8f6fa9934687423ce2a6 (diff) | |
| download | rust-9f28de513a309af7593e8959f92ec11e07ea255f.tar.gz rust-9f28de513a309af7593e8959f92ec11e07ea255f.zip | |
Free late-bound lifetimes in closures as well
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/lifetimes.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/lifetimes.rs b/compiler/rustc_hir_analysis/src/collect/lifetimes.rs index 3f263a6de24..3d07f3fbc67 100644 --- a/compiler/rustc_hir_analysis/src/collect/lifetimes.rs +++ b/compiler/rustc_hir_analysis/src/collect/lifetimes.rs @@ -1377,11 +1377,12 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } else if let Some(body_id) = outermost_body { let fn_id = self.tcx.hir().body_owner(body_id); match self.tcx.hir().get(fn_id) { - Node::Item(&hir::Item { kind: hir::ItemKind::Fn(..), .. }) - | Node::TraitItem(&hir::TraitItem { + Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. }) + | Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. }) - | Node::ImplItem(&hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }) => { + | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }) + | Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => { let scope = self.tcx.hir().local_def_id(fn_id); def = Region::Free(scope.to_def_id(), def.id().unwrap()); } |
