Add an indirection for closures in hir::ExprKind
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
This commit is contained in:
parent
3ebb852956
commit
df4fee9841
26 changed files with 101 additions and 79 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue