about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs1
-rw-r--r--src/libsyntax/ext/deriving/mod.rs22
-rw-r--r--src/libsyntax/fold.rs3
-rw-r--r--src/libsyntax/parse/parser.rs27
4 files changed, 35 insertions, 18 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index bef88e58a17..6071cc643a3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -892,6 +892,7 @@ impl to_bytes::IterBytes for Onceness {
 pub struct TyClosure {
     sigil: Sigil,
     region: Option<@Lifetime>,
+    lifetimes: OptVec<Lifetime>,
     purity: purity,
     onceness: Onceness,
     decl: fn_decl
diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs
index 57fddd623d4..e879bcdc476 100644
--- a/src/libsyntax/ext/deriving/mod.rs
+++ b/src/libsyntax/ext/deriving/mod.rs
@@ -34,16 +34,18 @@ pub mod clone;
 pub mod eq;
 pub mod iter_bytes;
 
-type ExpandDerivingStructDefFn = &'self fn(@ext_ctxt,
-                                          span,
-                                          x: &struct_def,
-                                          ident,
-                                          y: &Generics) -> @item;
-type ExpandDerivingEnumDefFn = &'self fn(@ext_ctxt,
-                                        span,
-                                        x: &enum_def,
-                                        ident,
-                                        y: &Generics) -> @item;
+type ExpandDerivingStructDefFn<'self> = &'self fn(@ext_ctxt,
+                                                  span,
+                                                  x: &struct_def,
+                                                  ident,
+                                                  y: &Generics)
+                                               -> @item;
+type ExpandDerivingEnumDefFn<'self> = &'self fn(@ext_ctxt,
+                                                span,
+                                                x: &enum_def,
+                                                ident,
+                                                y: &Generics)
+                                             -> @item;
 
 pub fn expand_meta_deriving(cx: @ext_ctxt,
                             _span: span,
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index b3974acc674..017e95ab4c1 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -609,7 +609,8 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
                 purity: f.purity,
                 region: f.region,
                 onceness: f.onceness,
-                decl: fold_fn_decl(&f.decl, fld)
+                decl: fold_fn_decl(&f.decl, fld),
+                lifetimes: f.lifetimes,
             })
         }
         ty_bare_fn(ref f) => {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 962607ffec4..cc0196d18de 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -362,10 +362,11 @@ pub impl Parser {
 
         let purity = self.parse_purity();
         self.expect_keyword(&~"fn");
+        let (decl, _) = self.parse_ty_fn_decl();
         return ty_bare_fn(@TyBareFn {
             abi: RustAbi,
             purity: purity,
-            decl: self.parse_ty_fn_decl()
+            decl: decl
         });
     }
 
@@ -400,12 +401,15 @@ pub impl Parser {
                           ObsoletePostFnTySigil);
         }
 
+        let (decl, lifetimes) = self.parse_ty_fn_decl();
+
         return ty_closure(@TyClosure {
             sigil: sigil,
             region: region,
             purity: purity,
             onceness: onceness,
-            decl: self.parse_ty_fn_decl()
+            decl: decl,
+            lifetimes: lifetimes,
         });
 
         fn parse_onceness(self: &Parser) -> Onceness {
@@ -424,7 +428,7 @@ pub impl Parser {
         }
     }
 
-    fn parse_ty_fn_decl(&self) -> fn_decl {
+    fn parse_ty_fn_decl(&self) -> (fn_decl, OptVec<ast::Lifetime>) {
         /*
 
         (fn) <'lt> (S) -> T
@@ -435,10 +439,14 @@ pub impl Parser {
            Lifetimes
 
         */
-        if self.eat(&token::LT) {
-            let _lifetimes = self.parse_lifetimes();
+        let lifetimes = if self.eat(&token::LT) {
+            let lifetimes = self.parse_lifetimes();
             self.expect_gt();
-        }
+            lifetimes
+        } else {
+            opt_vec::Empty
+        };
+
         let inputs = self.parse_unspanned_seq(
             &token::LPAREN,
             &token::RPAREN,
@@ -446,7 +454,12 @@ pub impl Parser {
             |p| p.parse_arg_general(false)
         );
         let (ret_style, ret_ty) = self.parse_ret_ty();
-        ast::fn_decl { inputs: inputs, output: ret_ty, cf: ret_style }
+        let decl = ast::fn_decl {
+            inputs: inputs,
+            output: ret_ty,
+            cf: ret_style
+        };
+        (decl, lifetimes)
     }
 
     fn parse_trait_methods(&self) -> ~[trait_method] {