diff options
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 0e687c02c1d..f7eddca4b7a 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -876,14 +876,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn lambda_fn_decl(&self, span: Span, fn_decl: P<ast::FnDecl>, blk: P<ast::Block>) -> Gc<ast::Expr> { - self.expr(span, ast::ExprFnBlock(fn_decl, blk)) + self.expr(span, ast::ExprFnBlock(ast::CaptureByRef, fn_decl, blk)) } fn lambda(&self, span: Span, ids: Vec<ast::Ident> , blk: P<ast::Block>) -> Gc<ast::Expr> { let fn_decl = self.fn_decl( ids.iter().map(|id| self.arg(span, *id, self.ty_infer(span))).collect(), self.ty_infer(span)); - self.expr(span, ast::ExprFnBlock(fn_decl, blk)) + self.expr(span, ast::ExprFnBlock(ast::CaptureByRef, fn_decl, blk)) } fn lambda0(&self, span: Span, blk: P<ast::Block>) -> Gc<ast::Expr> { self.lambda(span, Vec::new(), blk) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 808532d55bb..d918b28d4dc 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -74,10 +74,12 @@ fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> { fld.cx.expr(e.span, ast::ExprForLoop(pat, head, body, opt_ident)) } - ast::ExprFnBlock(fn_decl, block) => { + ast::ExprFnBlock(capture_clause, fn_decl, block) => { let (rewritten_fn_decl, rewritten_block) = expand_and_rename_fn_decl_and_block(&*fn_decl, block, fld); - let new_node = ast::ExprFnBlock(rewritten_fn_decl, rewritten_block); + let new_node = ast::ExprFnBlock(capture_clause, + rewritten_fn_decl, + rewritten_block); box(GC) ast::Expr{id:e.id, node: new_node, span: fld.new_span(e.span)} } |
