diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-04-20 14:44:07 -0400 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-04-24 18:10:57 +0530 |
| commit | ecd10f04cea34352ff240b0462d40cd1d95a4e0f (patch) | |
| tree | fb7f1f7adc4a1044d3a9316631fef61e46ce984b /src/libsyntax/ext/expand.rs | |
| parent | 23ccaddaa7d1cb71e49ef1b1f423b3245fa3a879 (diff) | |
| download | rust-ecd10f04cea34352ff240b0462d40cd1d95a4e0f.tar.gz rust-ecd10f04cea34352ff240b0462d40cd1d95a4e0f.zip | |
thread tighter span for closures around
Track the span corresponding to the `|...|` part of the closure.
Diffstat (limited to 'src/libsyntax/ext/expand.rs')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index cd7b0fcfb00..38132eb42ee 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -149,14 +149,17 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> { fld.cx.expr(span, il).with_attrs(fold_thin_attrs(attrs, fld)) } - ast::ExprKind::Closure(capture_clause, fn_decl, block) => { + ast::ExprKind::Closure(capture_clause, fn_decl, block, fn_decl_span) => { let (rewritten_fn_decl, rewritten_block) = expand_and_rename_fn_decl_and_block(fn_decl, block, fld); let new_node = ast::ExprKind::Closure(capture_clause, - rewritten_fn_decl, - rewritten_block); - P(ast::Expr{id:id, node: new_node, span: fld.new_span(span), - attrs: fold_thin_attrs(attrs, fld)}) + rewritten_fn_decl, + rewritten_block, + fld.new_span(fn_decl_span)); + P(ast::Expr{ id:id, + node: new_node, + span: fld.new_span(span), + attrs: fold_thin_attrs(attrs, fld) }) } _ => { |
