diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-07-11 23:39:53 +0400 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-07-12 21:00:13 +0400 |
| commit | df4fee9841e21ac84335d214af163a1b652ec9a2 (patch) | |
| tree | 1c4b627415d86b8c27061a26a97c6151f3812092 /compiler/rustc_passes | |
| parent | 3ebb8529560b9b80f38467bac86d686f5dae4934 (diff) | |
| download | rust-df4fee9841e21ac84335d214af163a1b652ec9a2.tar.gz rust-df4fee9841e21ac84335d214af163a1b652ec9a2.zip | |
Add an indirection for closures in `hir::ExprKind`
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
Diffstat (limited to 'compiler/rustc_passes')
| -rw-r--r-- | compiler/rustc_passes/src/loops.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/reachable.rs | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_passes/src/loops.rs b/compiler/rustc_passes/src/loops.rs index 68b2a052391..cdda0e388dd 100644 --- a/compiler/rustc_passes/src/loops.rs +++ b/compiler/rustc_passes/src/loops.rs @@ -57,7 +57,13 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { hir::ExprKind::Loop(ref b, _, source, _) => { self.with_context(Loop(source), |v| v.visit_block(&b)); } - hir::ExprKind::Closure { ref fn_decl, body, fn_decl_span, movability, .. } => { + hir::ExprKind::Closure(&hir::Closure { + ref fn_decl, + body, + fn_decl_span, + movability, + .. + }) => { let cx = if let Some(Movability::Static) = movability { AsyncClosure(fn_decl_span) } else { diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index c830ab11e8e..f7e3fac6b2e 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -273,7 +273,10 @@ impl<'tcx> ReachableContext<'tcx> { } hir::ImplItemKind::TyAlias(_) => {} }, - Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure { body, .. }, .. }) => { + Node::Expr(&hir::Expr { + kind: hir::ExprKind::Closure(&hir::Closure { body, .. }), + .. + }) => { self.visit_nested_body(body); } // Nothing to recurse on for these |
