let mut strs: ~[~str] = nv.splitn('=', 1).map(|s| s.to_owned()).collect();
match strs.len() {
- 1u => (strs.pop(), ~""),
+ 1u => (strs.pop().unwrap(), ~""),
2u => {
- let end = strs.pop();
- (strs.pop(), end)
+ let end = strs.pop().unwrap();
+ (strs.pop().unwrap(), end)
}
n => fail!("Expected 1 or 2 strings, not {}", n)
}
// get bare program string
let mut tvec: ~[~str] = args.prog.split('/').map(|ts| ts.to_owned()).collect();
- let prog_short = tvec.pop();
+ let prog_short = tvec.pop().unwrap();
// copy to target
let copy_result = procsrv::run("", config.adb_path,
match r % 6 {
0 => {
m.pop_back();
- if v.len() > 0 { v.pop(); }
+ v.pop();
}
1 => {
m.pop_front();
}
pub fn end_tag(&mut self) {
- let last_size_pos = self.size_positions.pop();
+ let last_size_pos = self.size_positions.pop().unwrap();
let cur_pos = self.writer.tell();
self.writer.seek(last_size_pos as i64, io::SeekSet);
let size = (cur_pos as uint - last_size_pos - 4);
return None;
}
- let (path,idx) = self.todo.pop();
+ let (path,idx) = self.todo.pop().unwrap();
let ref pattern = self.dir_patterns[idx];
if pattern.matches_with(match path.filename_str() {
while !self.eof() {
self.parse_whitespace();
- if self.ch != '\"' {
+ if self.ch != '"' {
return self.error(~"key must be a string");
}
impl serialize::Decoder for Decoder {
fn read_nil(&mut self) -> () {
debug!("read_nil");
- match self.stack.pop() {
+ match self.stack.pop().unwrap() {
Null => (),
value => self.expected("null", &value)
}
fn read_bool(&mut self) -> bool {
debug!("read_bool");
- match self.stack.pop() {
+ match self.stack.pop().unwrap() {
Boolean(b) => b,
value => self.expected("boolean", &value)
}
fn read_f64(&mut self) -> f64 {
debug!("read_f64");
- match self.stack.pop() {
+ match self.stack.pop().unwrap() {
Number(f) => f,
value => self.expected("number", &value)
}
fn read_str(&mut self) -> ~str {
debug!("read_str");
- match self.stack.pop() {
+ match self.stack.pop().unwrap() {
String(s) => s,
value => self.expected("string", &value)
}
f: |&mut Decoder, uint| -> T)
-> T {
debug!("read_enum_variant(names={:?})", names);
- let name = match self.stack.pop() {
+ let name = match self.stack.pop().unwrap() {
String(s) => s,
Object(mut o) => {
let n = match o.pop(&~"variant") {
-> T {
debug!("read_struct(name={}, len={})", name, len);
let value = f(self);
- self.stack.pop();
+ self.stack.pop().unwrap();
value
}
f: |&mut Decoder| -> T)
-> T {
debug!("read_struct_field(name={}, idx={})", name, idx);
- match self.stack.pop() {
+ match self.stack.pop().unwrap() {
Object(mut obj) => {
let value = match obj.pop(&name.to_owned()) {
None => self.missing_field(name, obj),
}
fn read_option<T>(&mut self, f: |&mut Decoder, bool| -> T) -> T {
- match self.stack.pop() {
+ match self.stack.pop().unwrap() {
Null => f(self, false),
value => { self.stack.push(value); f(self, true) }
}
fn read_seq<T>(&mut self, f: |&mut Decoder, uint| -> T) -> T {
debug!("read_seq()");
- let len = match self.stack.pop() {
+ let len = match self.stack.pop().unwrap() {
List(list) => {
let len = list.len();
for v in list.move_rev_iter() {
fn read_map<T>(&mut self, f: |&mut Decoder, uint| -> T) -> T {
debug!("read_map()");
- let len = match self.stack.pop() {
+ let len = match self.stack.pop().unwrap() {
Object(obj) => {
let len = obj.len();
for (key, value) in obj.move_iter() {
/// Pop the greatest item from the queue - fails if empty
pub fn pop(&mut self) -> T {
- let mut item = self.data.pop();
+ let mut item = self.data.pop().unwrap();
if !self.is_empty() {
swap(&mut item, &mut self.data[0]);
self.siftdown(0);
let mut heap = PriorityQueue::from_vec(data);
while !heap.is_empty() {
assert_eq!(heap.top(), sorted.last().unwrap());
- assert_eq!(heap.pop(), sorted.pop());
+ assert_eq!(heap.pop(), sorted.pop().unwrap());
}
}
match cur {
'%' => { output.push(c); state = Nothing },
'c' => if stack.len() > 0 {
- match stack.pop() {
+ match stack.pop().unwrap() {
// if c is 0, use 0200 (128) for ncurses compatibility
Number(c) => output.push(if c == 0 { 128 } else { c } as u8),
_ => return Err(~"a non-char was used with %c")
'\'' => state = CharConstant,
'{' => state = IntConstant(0),
'l' => if stack.len() > 0 {
- match stack.pop() {
+ match stack.pop().unwrap() {
String(s) => stack.push(Number(s.len() as int)),
_ => return Err(~"a non-str was used with %l")
}
} else { return Err(~"stack is empty") },
'+' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x + y)),
_ => return Err(~"non-numbers on stack with +")
}
} else { return Err(~"stack is empty") },
'-' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x - y)),
_ => return Err(~"non-numbers on stack with -")
}
} else { return Err(~"stack is empty") },
'*' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x * y)),
_ => return Err(~"non-numbers on stack with *")
}
} else { return Err(~"stack is empty") },
'/' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x / y)),
_ => return Err(~"non-numbers on stack with /")
}
} else { return Err(~"stack is empty") },
'm' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x % y)),
_ => return Err(~"non-numbers on stack with %")
}
} else { return Err(~"stack is empty") },
'&' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x & y)),
_ => return Err(~"non-numbers on stack with &")
}
} else { return Err(~"stack is empty") },
'|' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x | y)),
_ => return Err(~"non-numbers on stack with |")
}
} else { return Err(~"stack is empty") },
'^' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(x ^ y)),
_ => return Err(~"non-numbers on stack with ^")
}
} else { return Err(~"stack is empty") },
'=' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(if x == y { 1 }
else { 0 })),
_ => return Err(~"non-numbers on stack with =")
}
} else { return Err(~"stack is empty") },
'>' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(if x > y { 1 }
else { 0 })),
_ => return Err(~"non-numbers on stack with >")
}
} else { return Err(~"stack is empty") },
'<' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(y), Number(x)) => stack.push(Number(if x < y { 1 }
else { 0 })),
_ => return Err(~"non-numbers on stack with <")
}
} else { return Err(~"stack is empty") },
'A' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(0), Number(_)) => stack.push(Number(0)),
(Number(_), Number(0)) => stack.push(Number(0)),
(Number(_), Number(_)) => stack.push(Number(1)),
}
} else { return Err(~"stack is empty") },
'O' => if stack.len() > 1 {
- match (stack.pop(), stack.pop()) {
+ match (stack.pop().unwrap(), stack.pop().unwrap()) {
(Number(0), Number(0)) => stack.push(Number(0)),
(Number(_), Number(_)) => stack.push(Number(1)),
_ => return Err(~"non-numbers on stack with logical or")
}
} else { return Err(~"stack is empty") },
'!' => if stack.len() > 0 {
- match stack.pop() {
+ match stack.pop().unwrap() {
Number(0) => stack.push(Number(1)),
Number(_) => stack.push(Number(0)),
_ => return Err(~"non-number on stack with logical not")
}
} else { return Err(~"stack is empty") },
'~' => if stack.len() > 0 {
- match stack.pop() {
+ match stack.pop().unwrap() {
Number(x) => stack.push(Number(!x)),
_ => return Err(~"non-number on stack with %~")
}
// printf-style support for %doxXs
'd'|'o'|'x'|'X'|'s' => if stack.len() > 0 {
let flags = Flags::new();
- let res = format(stack.pop(), FormatOp::from_char(cur), flags);
+ let res = format(stack.pop().unwrap(), FormatOp::from_char(cur), flags);
if res.is_err() { return res }
output.push_all(res.unwrap())
} else { return Err(~"stack is empty") },
// conditionals
'?' => (),
't' => if stack.len() > 0 {
- match stack.pop() {
+ match stack.pop().unwrap() {
Number(0) => state = SeekIfElse(0),
Number(_) => (),
_ => return Err(~"non-number on stack with conditional")
if cur >= 'A' && cur <= 'Z' {
if stack.len() > 0 {
let idx = (cur as u8) - ('A' as u8);
- vars.sta[idx] = stack.pop();
+ vars.sta[idx] = stack.pop().unwrap();
} else { return Err(~"stack is empty") }
} else if cur >= 'a' && cur <= 'z' {
if stack.len() > 0 {
let idx = (cur as u8) - ('a' as u8);
- vars.dyn[idx] = stack.pop();
+ vars.dyn[idx] = stack.pop().unwrap();
} else { return Err(~"stack is empty") }
} else {
return Err(~"bad variable name in %P");
old_state = Nothing;
match (*fstate, cur) {
(_,'d')|(_,'o')|(_,'x')|(_,'X')|(_,'s') => if stack.len() > 0 {
- let res = format(stack.pop(), FormatOp::from_char(cur), *flags);
+ let res = format(stack.pop().unwrap(), FormatOp::from_char(cur), *flags);
if res.is_err() { return res }
output.push_all(res.unwrap());
old_state = state; // will cause state to go to Nothing
while pending > 0 || !remaining.is_empty() {
while pending < concurrency && !remaining.is_empty() {
- let test = remaining.pop();
+ let test = remaining.pop().unwrap();
if concurrency == 1 {
// We are doing one test at a time so we can print the name
// of the test before we run it. Useful for debugging tests
}
self.stack.push(node);
} else {
- let node = self.stack.pop();
+ let node = self.stack.pop().unwrap();
let next_node = if forward {
addr!(& $($addr_mut)* node.right)
} else {
left: left,
right: right,
level: level
- } = self.stack.pop();
+ } = self.stack.pop().unwrap();
match left {
Some(~left) => {
ports.push(port);
});
- while !ports.is_empty() {
- ports.pop().recv();
+ loop {
+ match ports.pop() {
+ Some(port) => port.recv(),
+ None => break,
+ }
}
}
}
}
pub fn pop_repeating_id(&mut self, id: ast::NodeId) {
- let popped = self.repeating_ids.pop();
+ let popped = self.repeating_ids.pop().unwrap();
assert_eq!(id, popped);
}
// add the bits from any early return via `break`,
// `continue`, or `return` into `func_bits`
- let loop_scope = loop_scopes.pop();
+ let loop_scope = loop_scopes.pop().unwrap();
join_bits(&self.dfcx.oper, loop_scope.break_bits, func_bits);
// add `func_bits` to the entry bits for `expr`,
});
self.walk_block(blk, body_bits, loop_scopes);
self.add_to_entry_set(expr.id, body_bits);
- let new_loop_scope = loop_scopes.pop();
+ let new_loop_scope = loop_scopes.pop().unwrap();
copy_bits(new_loop_scope.break_bits, in_out);
}
self.walk_block(blk, body_bits, loop_scopes);
self.add_to_entry_set(expr.id, body_bits);
- let new_loop_scope = loop_scopes.pop();
+ let new_loop_scope = loop_scopes.pop().unwrap();
assert_eq!(new_loop_scope.loop_id, expr.id);
copy_bits(new_loop_scope.break_bits, in_out);
}
fn mark_live_symbols(&mut self) {
let mut scanned = HashSet::new();
while self.worklist.len() > 0 {
- let id = self.worklist.pop();
+ let id = self.worklist.pop().unwrap();
if scanned.contains(&id) {
continue
}
if worklist.get().len() == 0 {
break
}
- let search_item = worklist.get().pop();
+ let search_item = worklist.get().pop().unwrap();
if scanned.contains(&search_item) {
continue
}
let llbb = self.get_or_create_landing_pad();
// Push the scopes we removed back on:
- while !popped_scopes.is_empty() {
- self.push_scope(popped_scopes.pop());
+ loop {
+ match popped_scopes.pop() {
+ Some(scope) => self.push_scope(scope),
+ None => break
+ }
}
assert_eq!(self.scopes_len(), orig_scopes_len);
self.scopes_len() - 1);
let mut scopes = self.scopes.borrow_mut();
- scopes.get().pop()
+ scopes.get().pop().unwrap()
}
fn top_scope<R>(&self, f: |&CleanupScope<'a>| -> R) -> R {
// At this point, `popped_scopes` is empty, and so the final block
// that we return to the user is `Cleanup(AST 24)`.
while !popped_scopes.is_empty() {
- let mut scope = popped_scopes.pop();
+ let mut scope = popped_scopes.pop().unwrap();
if scope.cleanups.iter().any(|c| cleanup_is_suitable_for(*c, label))
{
seen.push(did);
let fields = struct_fields(cx, did, substs);
let r = fields.iter().any(|f| type_requires(cx, seen, r_ty, f.mt.ty));
- seen.pop();
+ seen.pop().unwrap();
r
}
type_requires(cx, seen, r_ty, sty)
})
});
- seen.pop();
+ seen.pop().unwrap();
r
}
};
self.relate(r);
self.stack.push(r);
ty_fold::super_fold_ty(self, mt.ty);
- self.stack.pop();
+ self.stack.pop().unwrap();
}
_ => {
fn rollback_to<V:Clone + Vid,T:Clone>(vb: &mut ValsAndBindings<V, T>,
len: uint) {
while vb.bindings.len() != len {
- let (vid, old_v) = vb.bindings.pop();
+ let (vid, old_v) = vb.bindings.pop().unwrap();
vb.vals.insert(vid.to_uint(), old_v);
}
}
debug!("RegionVarBindings: commit()");
let mut undo_log = self.undo_log.borrow_mut();
while undo_log.get().len() > 0 {
- undo_log.get().pop();
+ undo_log.get().pop().unwrap();
}
}
debug!("RegionVarBindings: rollback_to({})", snapshot);
let mut undo_log = self.undo_log.borrow_mut();
while undo_log.get().len() > snapshot {
- let undo_item = undo_log.get().pop();
+ let undo_item = undo_log.get().pop().unwrap();
debug!("undo_item={:?}", undo_item);
match undo_item {
Snapshot => {}
AddVar(vid) => {
let mut var_origins = self.var_origins.borrow_mut();
assert_eq!(var_origins.get().len(), vid.to_uint() + 1);
- var_origins.get().pop();
+ var_origins.get().pop().unwrap();
}
AddConstraint(ref constraint) => {
let mut constraints = self.constraints.borrow_mut();
process_edges(self, &mut state, graph, orig_node_idx, dir);
while !state.stack.is_empty() {
- let node_idx = state.stack.pop();
+ let node_idx = state.stack.pop().unwrap();
let classification = var_data[node_idx.to_uint()].classification;
// check whether we've visited this node on some previous walk
ty::mk_var(tcx, vid)
}
};
- self.v_seen.pop();
+ self.v_seen.pop().unwrap();
return t1;
}
}
i => i,
};
- if pushed { self.stack.pop(); }
- if parent_pushed { self.parent_stack.pop(); }
+ if pushed { self.stack.pop().unwrap(); }
+ if parent_pushed { self.parent_stack.pop().unwrap(); }
self.privmod = orig_privmod;
return ret;
}
self.dst = prev;
let len = self.root_path.len();
self.root_path.truncate(len - 3);
- self.current.pop();
+ self.current.pop().unwrap();
return ret;
}
local_data::set(cache_key, Arc::new(cache));
let mut work = ~[(self, item)];
- while work.len() > 0 {
- let (mut cx, item) = work.pop();
- cx.item(item, |cx, item| {
- work.push((cx.clone(), item));
- })
+ loop {
+ match work.pop() {
+ Some((mut cx, item)) => cx.item(item, |cx, item| {
+ work.push((cx.clone(), item));
+ }),
+ None => break,
+ }
}
}
None
}
else {
- let last = self.components.pop();
+ let last = self.components.pop().unwrap();
self.remaining.unshift(last);
// converting to str and then back is a little unfortunate
Some((Path::new(self.components.connect("/")),
fn drop(&mut self) {
// Close all I/O before exiting to ensure that the child doesn't wait
// forever to print some text or something similar.
- for _ in range(0, self.io.len()) {
- self.io.pop();
+ loop {
+ match self.io.pop() {
+ Some(_) => (),
+ None => break,
+ }
}
self.wait();
char::from_digit(val, radix).unwrap() as u8
};
- let extra_digit = ascii2value(buf.pop());
+ let extra_digit = ascii2value(buf.pop().unwrap());
if extra_digit >= radix / 2 { // -> need to round
let mut i: int = buf.len() as int - 1;
loop {
else if comp == bytes!("..") {
if is_abs && comps.is_empty() { changed = true }
else if comps.len() == n_up { comps.push(dot_dot_static); n_up += 1 }
- else { comps.pop(); changed = true }
+ else { comps.pop().unwrap(); changed = true }
} else { comps.push(comp) }
}
if changed {
};
if (is_abs || has_abs_prefix) && comps.is_empty() { changed = true }
else if comps.len() == n_up { comps.push(".."); n_up += 1 }
- else { comps.pop(); changed = true }
+ else { comps.pop().unwrap(); changed = true }
} else { comps.push(comp) }
}
if !changed && !prefix_is_verbatim(prefix) {
self.ptr_stk.push(self.ptr);
}
fn pop_ptr(&mut self) {
- self.ptr = self.ptr_stk.pop();
+ self.ptr = self.ptr_stk.pop().unwrap();
}
}
n_fields: uint,
name: &str) -> bool {
let mut write = false;
- match self.var_stk.pop() {
+ match self.var_stk.pop().unwrap() {
SearchingFor(sought) => {
if disr_val == sought {
self.var_stk.push(Matched);
_sz: uint,
_align: uint)
-> bool {
- match self.var_stk.pop() {
+ match self.var_stk.pop().unwrap() {
SearchingFor(..) => fail!("enum value matched no variant"),
_ => true
}
/// assert!(a == ~[~1, ~2, ~3, ~4]);
/// ```
fn push_all_move(&mut self, rhs: ~[T]);
- /// Remove the last element from a vector and return it, failing if it is empty
- fn pop(&mut self) -> T;
/// Remove the last element from a vector and return it, or `None` if it is empty
- fn pop_opt(&mut self) -> Option<T>;
+ fn pop(&mut self) -> Option<T>;
/// Removes the first element from a vector and return it
fn shift(&mut self) -> T;
/// Removes the first element from a vector and return it, or `None` if it is empty
}
}
- fn pop_opt(&mut self) -> Option<T> {
+ fn pop(&mut self) -> Option<T> {
match self.len() {
0 => None,
ln => {
}
- #[inline]
- fn pop(&mut self) -> T {
- self.pop_opt().expect("pop: empty vector")
- }
-
#[inline]
fn shift(&mut self) -> T {
self.shift_opt().expect("shift: empty vector")
assert_eq!(vec.slice_to(0), &[]);
}
- #[test]
- fn test_pop() {
- // Test on-heap pop.
- let mut v = ~[1, 2, 3, 4, 5];
- let e = v.pop();
- assert_eq!(v.len(), 4u);
- assert_eq!(v[0], 1);
- assert_eq!(v[1], 2);
- assert_eq!(v[2], 3);
- assert_eq!(v[3], 4);
- assert_eq!(e, 5);
- }
#[test]
- fn test_pop_opt() {
+ fn test_pop() {
let mut v = ~[5];
- let e = v.pop_opt();
+ let e = v.pop();
assert_eq!(v.len(), 0);
assert_eq!(e, Some(5));
- let f = v.pop_opt();
+ let f = v.pop();
assert_eq!(f, None);
- let g = v.pop_opt();
+ let g = v.pop();
assert_eq!(g, None);
}
_ => {}
}
- self.path.pop();
+ self.path.pop().unwrap();
SmallVector::one(i)
}
/// 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);
}
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 {
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 {
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 {
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);
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
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();
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 {
} 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(
{
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();
}
}
}
}
- 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
}
}
// Parse the close delimiter.
result.push(parse_any_tt_tok(self));
- self.open_braces.pop();
+ self.open_braces.pop().unwrap();
TTDelim(@result)
}
}
);
- let variadic = match args.pop_opt() {
+ let variadic = match args.pop() {
Some(None) => true,
Some(x) => {
// Need to put back that last arg
}
fn pop_mod_path(&mut self) {
- self.mod_path_stack.pop();
+ self.mod_path_stack.pop().unwrap();
}
// read a module from a source file.
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();
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);
}
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
}
while state.is_empty() {
cond.wait();
}
- state.pop()
+ state.pop().unwrap()
})
}
}
while state.is_empty() {
cond.wait();
}
- state.pop()
+ state.pop().unwrap()
})
}