about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-04-24 18:12:57 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-04-24 18:13:50 +0530
commit17ba11d105937ec980928f292d96f17c1a41fe02 (patch)
tree7a432350551dca07301964d3976dec283fbf3965 /src/libsyntax/parse/parser.rs
parent8d0dd7876e733555b0284e9b6cbf0f33ed792b67 (diff)
parentecd10f04cea34352ff240b0462d40cd1d95a4e0f (diff)
downloadrust-17ba11d105937ec980928f292d96f17c1a41fe02.tar.gz
rust-17ba11d105937ec980928f292d96f17c1a41fe02.zip
Rollup merge of #33125 - Manishearth:closure-span, r=Manishearth
 Track the span corresponding to the `|...|` part of the closure.

lifted from #32756
cc #31645

libsyntax-[breaking change]
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index f3d3bbd9f99..a4284d0b674 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3225,13 +3225,15 @@ impl<'a> Parser<'a> {
         Ok(self.mk_expr(lo, hi, ExprKind::IfLet(pat, expr, thn, els), attrs))
     }
 
-    // `|args| expr`
-    pub fn parse_lambda_expr(&mut self, lo: BytePos,
+    // `move |args| expr`
+    pub fn parse_lambda_expr(&mut self,
+                             lo: BytePos,
                              capture_clause: CaptureBy,
                              attrs: ThinAttributes)
                              -> PResult<'a, P<Expr>>
     {
         let decl = self.parse_fn_block_decl()?;
+        let decl_hi = self.last_span.hi;
         let body = match decl.output {
             FunctionRetTy::Default(_) => {
                 // If no explicit return type is given, parse any
@@ -3255,7 +3257,8 @@ impl<'a> Parser<'a> {
         Ok(self.mk_expr(
             lo,
             body.span.hi,
-            ExprKind::Closure(capture_clause, decl, body), attrs))
+            ExprKind::Closure(capture_clause, decl, body, mk_sp(lo, decl_hi)),
+            attrs))
     }
 
     // `else` token already eaten