about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2014-03-07 16:50:40 +0100
committerFelix S. Klock II <pnkfelix@pnkfx.org>2014-03-12 08:05:20 +0100
commit586b619c76a3e5798283408954a0306d86ebc1ef (patch)
treeae1f2910935851e30fbbef23b9d5465b1f117461 /src/libsyntax/parse/parser.rs
parent28ebec516015eb0b9cef05e5da0685a18620b105 (diff)
downloadrust-586b619c76a3e5798283408954a0306d86ebc1ef.tar.gz
rust-586b619c76a3e5798283408954a0306d86ebc1ef.zip
Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.
There is a broader revision (that does this across the board) pending
in #12675, but that is awaiting the arrival of more data (to decide
whether to keep OptVec alive by using a non-Vec internally).

For this code, the representation of lifetime lists needs to be the
same in both ScopeChain and in the ast and ty structures.  So it
seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper
empty representation than the current `vec` code.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index f80fc78b79c..7760ca89eb2 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -958,7 +958,7 @@ impl Parser {
 
                     lifetimes
                 } else {
-                    opt_vec::Empty
+                    Vec::new()
                 };
 
                 let inputs = if self.eat(&token::OROR) {
@@ -1015,7 +1015,7 @@ impl Parser {
 
     // parse a function type (following the 'fn')
     pub fn parse_ty_fn_decl(&mut self, allow_variadic: bool)
-                            -> (P<FnDecl>, OptVec<ast::Lifetime>) {
+                            -> (P<FnDecl>, Vec<ast::Lifetime>) {
         /*
 
         (fn) <'lt> (S) -> T
@@ -1031,7 +1031,7 @@ impl Parser {
             self.expect_gt();
             lifetimes
         } else {
-            opt_vec::Empty
+            Vec::new()
         };
 
         let (inputs, variadic) = self.parse_fn_args(false, allow_variadic);
@@ -1510,7 +1510,7 @@ impl Parser {
                 segments.push(PathSegmentAndBoundSet {
                     segment: ast::PathSegment {
                         identifier: identifier,
-                        lifetimes: opt_vec::Empty,
+                        lifetimes: Vec::new(),
                         types: opt_vec::Empty,
                     },
                     bound_set: bound_set
@@ -1525,7 +1525,7 @@ impl Parser {
                         self.parse_generic_values_after_lt();
                     (true, lifetimes, opt_vec::from(types))
                 } else {
-                    (false, opt_vec::Empty, opt_vec::Empty)
+                    (false, Vec::new(), opt_vec::Empty)
                 }
             };
 
@@ -1621,7 +1621,7 @@ impl Parser {
     // matches lifetimes = ( lifetime ) | ( lifetime , lifetimes )
     // actually, it matches the empty one too, but putting that in there
     // messes up the grammar....
-    pub fn parse_lifetimes(&mut self) -> OptVec<ast::Lifetime> {
+    pub fn parse_lifetimes(&mut self) -> Vec<ast::Lifetime> {
         /*!
          *
          * Parses zero or more comma separated lifetimes.
@@ -1630,7 +1630,7 @@ impl Parser {
          * lists, where we expect something like `<'a, 'b, T>`.
          */
 
-        let mut res = opt_vec::Empty;
+        let mut res = Vec::new();
         loop {
             match self.token {
                 token::LIFETIME(_) => {
@@ -1995,7 +1995,7 @@ impl Parser {
                         self.expect(&token::LT);
                         self.parse_generic_values_after_lt()
                     } else {
-                        (opt_vec::Empty, Vec::new())
+                        (Vec::new(), Vec::new())
                     };
 
                     // expr.f() method call
@@ -3515,7 +3515,7 @@ impl Parser {
         }
     }
 
-    fn parse_generic_values_after_lt(&mut self) -> (OptVec<ast::Lifetime>, Vec<P<Ty>> ) {
+    fn parse_generic_values_after_lt(&mut self) -> (Vec<ast::Lifetime>, Vec<P<Ty>> ) {
         let lifetimes = self.parse_lifetimes();
         let result = self.parse_seq_to_gt(
             Some(token::COMMA),
@@ -4886,7 +4886,7 @@ impl Parser {
                 segments: path.move_iter().map(|identifier| {
                     ast::PathSegment {
                         identifier: identifier,
-                        lifetimes: opt_vec::Empty,
+                        lifetimes: Vec::new(),
                         types: opt_vec::Empty,
                     }
                 }).collect()
@@ -4921,7 +4921,7 @@ impl Parser {
                         segments: path.move_iter().map(|identifier| {
                             ast::PathSegment {
                                 identifier: identifier,
-                                lifetimes: opt_vec::Empty,
+                                lifetimes: Vec::new(),
                                 types: opt_vec::Empty,
                             }
                         }).collect()
@@ -4939,7 +4939,7 @@ impl Parser {
                         segments: path.move_iter().map(|identifier| {
                             ast::PathSegment {
                                 identifier: identifier,
-                                lifetimes: opt_vec::Empty,
+                                lifetimes: Vec::new(),
                                 types: opt_vec::Empty,
                             }
                         }).collect()
@@ -4961,7 +4961,7 @@ impl Parser {
             segments: path.move_iter().map(|identifier| {
                 ast::PathSegment {
                     identifier: identifier,
-                    lifetimes: opt_vec::Empty,
+                    lifetimes: Vec::new(),
                     types: opt_vec::Empty,
                 }
             }).collect()