about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2013-12-23 16:20:52 +0100
committerSimon Sapin <simon.sapin@exyr.org>2014-01-21 15:48:47 -0800
commitbada25e425ae30583ad343e36a034e59c66fcad6 (patch)
tree4e07ddbe72ef54075d401322c8283de064f02b4e /src/libsyntax
parentaa66b91767ce92c45192ca11718575529d631d21 (diff)
downloadrust-bada25e425ae30583ad343e36a034e59c66fcad6.tar.gz
rust-bada25e425ae30583ad343e36a034e59c66fcad6.zip
[std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behavior
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs2
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/deriving/generic.rs4
-rw-r--r--src/libsyntax/ext/registrar.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs13
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs4
-rw-r--r--src/libsyntax/opt_vec.rs4
-rw-r--r--src/libsyntax/parse/parser.rs6
-rw-r--r--src/libsyntax/print/pp.rs2
-rw-r--r--src/libsyntax/print/pprust.rs6
12 files changed, 26 insertions, 23 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 72ab81d8657..0585f1abecc 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -340,7 +340,7 @@ impl<F: FoldOps> Folder for Ctx<F> {
             _ => {}
         }
 
-        self.path.pop();
+        self.path.pop().unwrap();
 
         SmallVector::one(i)
     }
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 6472551b049..47ae146d19b 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -904,7 +904,7 @@ pub fn mtwt_outer_mark(ctxt: SyntaxContext) -> Mrk {
 /// case pop and discard (so two of the same marks cancel)
 pub fn xorPush(marks: &mut ~[Mrk], mark: Mrk) {
     if (marks.len() > 0) && (getLast(marks) == mark) {
-        marks.pop();
+        marks.pop().unwrap();
     } else {
         marks.push(mark);
     }
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index a90e118d02b..86982201303 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -356,7 +356,7 @@ impl<'a> ExtCtxt<'a> {
     pub fn print_backtrace(&self) { }
     pub fn backtrace(&self) -> Option<@ExpnInfo> { self.backtrace }
     pub fn mod_push(&mut self, i: ast::Ident) { self.mod_path.push(i); }
-    pub fn mod_pop(&mut self) { self.mod_path.pop(); }
+    pub fn mod_pop(&mut self) { self.mod_path.pop().unwrap(); }
     pub fn mod_path(&self) -> ~[ast::Ident] { self.mod_path.clone() }
     pub fn bt_push(&mut self, ei: codemap::ExpnInfo) {
         match ei {
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index d702ee3ead4..3c0d7aaf4f3 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -253,7 +253,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
                 lifetimes: OptVec<ast::Lifetime>,
                 types: ~[P<ast::Ty>])
                 -> ast::Path {
-        let last_identifier = idents.pop();
+        let last_identifier = idents.pop().unwrap();
         let mut segments: ~[ast::PathSegment] = idents.move_iter()
                                                       .map(|ident| {
             ast::PathSegment {
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index cddfa7d2aa0..fe519a31efa 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -841,7 +841,7 @@ impl<'a> MethodDef<'a> {
                                                      matching,
                                                      matches_so_far,
                                                      match_count + 1);
-                matches_so_far.pop();
+                matches_so_far.pop().unwrap();
                 arms.push(cx.arm(trait_.span, ~[ pattern ], arm_expr));
 
                 if enum_def.variants.len() > 1 {
@@ -875,7 +875,7 @@ impl<'a> MethodDef<'a> {
                                                          new_matching,
                                                          matches_so_far,
                                                          match_count + 1);
-                    matches_so_far.pop();
+                    matches_so_far.pop().unwrap();
 
                     let arm = cx.arm(trait_.span, ~[ pattern ], arm_expr);
                     arms.push(arm);
diff --git a/src/libsyntax/ext/registrar.rs b/src/libsyntax/ext/registrar.rs
index 265dd91d7f4..1c349c4343a 100644
--- a/src/libsyntax/ext/registrar.rs
+++ b/src/libsyntax/ext/registrar.rs
@@ -42,7 +42,7 @@ pub fn find_macro_registrar(diagnostic: @diagnostic::SpanHandler,
     match ctx.registrars.len() {
         0 => None,
         1 => {
-            let (node_id, _) = ctx.registrars.pop();
+            let (node_id, _) = ctx.registrars.pop().unwrap();
             Some(ast::DefId {
                 crate: ast::LOCAL_CRATE,
                 node: node_id
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index dc721f15c3b..492852c6a79 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -238,8 +238,11 @@ pub fn parse(sess: @ParseSess,
         let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
 
         /* we append new items to this while we go */
-        while !cur_eis.is_empty() { /* for each Earley Item */
-            let ei = cur_eis.pop();
+        loop {
+            let ei = match cur_eis.pop() {
+                None => break, /* for each Earley Item */
+                Some(ei) => ei,
+            };
 
             let idx = ei.idx;
             let len = ei.elts.len();
@@ -347,7 +350,7 @@ pub fn parse(sess: @ParseSess,
             if eof_eis.len() == 1u {
                 let mut v = ~[];
                 for dv in eof_eis[0u].matches.mut_iter() {
-                    v.push(dv.pop());
+                    v.push(dv.pop().unwrap());
                 }
                 return Success(nameize(sess, ms, v));
             } else if eof_eis.len() > 1u {
@@ -376,13 +379,13 @@ pub fn parse(sess: @ParseSess,
             } else if next_eis.len() > 0u {
                 /* Now process the next token */
                 while next_eis.len() > 0u {
-                    cur_eis.push(next_eis.pop());
+                    cur_eis.push(next_eis.pop().unwrap());
                 }
                 rdr.next_token();
             } else /* bb_eis.len() == 1 */ {
                 let mut rust_parser = Parser(sess, cfg.clone(), rdr.dup());
 
-                let mut ei = bb_eis.pop();
+                let mut ei = bb_eis.pop().unwrap();
                 match ei.elts[ei.idx].node {
                   MatchNonterminal(_, ref name, idx) => {
                     ei.matches[idx].push(@MatchedNonterminal(
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 4c78244bf08..20d544f52c9 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -204,8 +204,8 @@ pub fn tt_next_token(r: &TtReader) -> TokenAndSpan {
                     {
                         let mut repeat_idx = r.repeat_idx.borrow_mut();
                         let mut repeat_len = r.repeat_len.borrow_mut();
-                        repeat_idx.get().pop();
-                        repeat_len.get().pop();
+                        repeat_idx.get().pop().unwrap();
+                        repeat_len.get().pop().unwrap();
                     }
                 }
 
diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs
index d6f363eb6a0..ce3042cb9cd 100644
--- a/src/libsyntax/opt_vec.rs
+++ b/src/libsyntax/opt_vec.rs
@@ -48,10 +48,10 @@ impl<T> OptVec<T> {
         }
     }
 
-    pub fn pop(&mut self) -> T {
+    pub fn pop(&mut self) -> Option<T> {
         match *self {
             Vec(ref mut v) => v.pop(),
-            Empty => fail!("pop from empty opt_vec")
+            Empty => None
         }
     }
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 30408fa1c2b..4e1703fe6b0 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2158,7 +2158,7 @@ impl Parser {
 
                 // Parse the close delimiter.
                 result.push(parse_any_tt_tok(self));
-                self.open_braces.pop();
+                self.open_braces.pop().unwrap();
 
                 TTDelim(@result)
             }
@@ -3593,7 +3593,7 @@ impl Parser {
                 }
             );
 
-        let variadic = match args.pop_opt() {
+        let variadic = match args.pop() {
             Some(None) => true,
             Some(x) => {
                 // Need to put back that last arg
@@ -4218,7 +4218,7 @@ impl Parser {
     }
 
     fn pop_mod_path(&mut self) {
-        self.mod_path_stack.pop();
+        self.mod_path_stack.pop().unwrap();
     }
 
     // read a module from a source file.
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index c421c2f4d7a..902d9e1c284 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -511,7 +511,7 @@ impl Printer {
             debug!("print End -> pop End");
             let print_stack = &mut self.print_stack;
             assert!((print_stack.len() != 0u));
-            print_stack.pop();
+            print_stack.pop().unwrap();
           }
           Break(b) => {
             let top = self.get_top();
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 3ea48969069..cdfeebd3e1b 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -78,7 +78,7 @@ pub fn ibox(s: &mut State, u: uint) {
 pub fn end(s: &mut State) {
     {
         let mut boxes = s.boxes.borrow_mut();
-        boxes.get().pop();
+        boxes.get().pop().unwrap();
     }
     pp::end(&mut s.s);
 }
@@ -1090,11 +1090,11 @@ pub fn print_call_pre(s: &mut State,
     match sugar {
         ast::DoSugar => {
             head(s, "do");
-            Some(base_args.pop())
+            Some(base_args.pop().unwrap())
         }
         ast::ForSugar => {
             head(s, "for");
-            Some(base_args.pop())
+            Some(base_args.pop().unwrap())
         }
         ast::NoSugar => None
     }