mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Auto merge of #28116 - nrc:closure-expand, r=alexcrichton
This commit is contained in:
commit
ce40c48c45
@ -275,7 +275,6 @@ pub enum CompilerExpansionFormat {
|
||||
PlacementIn,
|
||||
WhileLet,
|
||||
ForLoop,
|
||||
Closure,
|
||||
}
|
||||
|
||||
impl CompilerExpansionFormat {
|
||||
@ -285,7 +284,6 @@ impl CompilerExpansionFormat {
|
||||
CompilerExpansionFormat::PlacementIn => "placement-in expansion",
|
||||
CompilerExpansionFormat::WhileLet => "while let expansion",
|
||||
CompilerExpansionFormat::ForLoop => "for loop expansion",
|
||||
CompilerExpansionFormat::Closure => "closure expansion",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -459,15 +459,12 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
|
||||
}
|
||||
|
||||
ast::ExprClosure(capture_clause, fn_decl, block) => {
|
||||
push_compiler_expansion(fld, span, CompilerExpansionFormat::Closure);
|
||||
let (rewritten_fn_decl, rewritten_block)
|
||||
= expand_and_rename_fn_decl_and_block(fn_decl, block, fld);
|
||||
let new_node = ast::ExprClosure(capture_clause,
|
||||
rewritten_fn_decl,
|
||||
rewritten_block);
|
||||
let result = P(ast::Expr{id:id, node: new_node, span: fld.new_span(span)});
|
||||
fld.cx.bt_pop();
|
||||
result
|
||||
P(ast::Expr{id:id, node: new_node, span: fld.new_span(span)})
|
||||
}
|
||||
|
||||
_ => {
|
||||
|
Loading…
Reference in New Issue
Block a user