From 276b8b125d3f60cebab702542b60207429fbb333 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Mon, 18 Aug 2014 17:52:38 -0700 Subject: [PATCH] Fallout from stabilizing core::option --- src/compiletest/procsrv.rs | 4 ++-- src/compiletest/runtest.rs | 6 +++--- src/libarena/lib.rs | 6 +++--- src/libcollections/dlist.rs | 2 +- src/libcollections/ringbuf.rs | 6 +++--- src/libcollections/treemap.rs | 12 ++++++------ src/libcore/cell.rs | 2 +- src/libcore/iter.rs | 7 ++++++- src/libcore/option.rs | 4 ++-- src/libcoretest/option.rs | 6 +++--- src/libglob/lib.rs | 4 ++-- src/libgreen/lib.rs | 2 +- src/libgreen/sched.rs | 20 +++++++++---------- src/libgreen/task.rs | 16 +++++++-------- src/libnative/io/timer_unix.rs | 2 +- src/libnative/lib.rs | 2 +- src/libnative/task.rs | 2 +- src/librustc/driver/driver.rs | 2 +- src/librustc/lint/context.rs | 2 +- src/librustc/middle/trans/base.rs | 2 +- src/librustc/middle/trans/monomorphize.rs | 2 +- src/librustdoc/clean/inline.rs | 6 +++--- src/librustdoc/clean/mod.rs | 14 ++++++------- src/librustdoc/html/render.rs | 24 +++++++++++------------ src/librustdoc/lib.rs | 2 +- src/librustrt/task.rs | 18 ++++++++--------- src/librustrt/thread.rs | 2 +- src/librustuv/addrinfo.rs | 2 +- src/librustuv/async.rs | 2 +- src/librustuv/lib.rs | 2 +- src/librustuv/net.rs | 4 ++-- src/librustuv/process.rs | 2 +- src/librustuv/stream.rs | 2 +- src/librustuv/timeout.rs | 2 +- src/librustuv/timer.rs | 4 ++-- src/librustuv/uvio.rs | 4 ++-- src/libstd/io/buffered.rs | 2 +- src/libstd/io/process.rs | 4 ++-- src/libstd/io/tempfile.rs | 2 +- src/libsync/comm/oneshot.rs | 4 ++-- src/libsync/comm/sync.rs | 6 +++--- src/libsync/mpsc_queue.rs | 2 +- src/libsync/raw.rs | 4 ++-- src/libunicode/u_str.rs | 4 ++-- src/test/bench/msgsend-ring-mutex-arcs.rs | 4 ++-- src/test/bench/msgsend-ring-rw-arcs.rs | 4 ++-- 46 files changed, 121 insertions(+), 116 deletions(-) diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 28ff2c18ad3ba..2c3aa88a68083 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -47,7 +47,7 @@ pub fn run(lib_path: &str, match cmd.spawn() { Ok(mut process) => { for input in input.iter() { - process.stdin.get_mut_ref().write(input.as_bytes()).unwrap(); + process.stdin.as_mut().unwrap().write(input.as_bytes()).unwrap(); } let ProcessOutput { status, output, error } = process.wait_with_output().unwrap(); @@ -79,7 +79,7 @@ pub fn run_background(lib_path: &str, match cmd.spawn() { Ok(mut process) => { for input in input.iter() { - process.stdin.get_mut_ref().write(input.as_bytes()).unwrap(); + process.stdin.as_mut().unwrap().write(input.as_bytes()).unwrap(); } Some(process) diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index b36bc96cd351c..7a0245164ec09 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1526,7 +1526,7 @@ fn compile_cc_with_clang_and_save_bitcode(config: &Config, _props: &TestProps, let testcc = testfile.with_extension("cc"); let proc_args = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths - prog: config.clang_path.get_ref().as_str().unwrap().to_string(), + prog: config.clang_path.as_ref().unwrap().as_str().unwrap().to_string(), args: vec!("-c".to_string(), "-emit-llvm".to_string(), "-o".to_string(), @@ -1542,7 +1542,7 @@ fn extract_function_from_bitcode(config: &Config, _props: &TestProps, let bitcodefile = output_base_name(config, testfile).with_extension("bc"); let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix); let extracted_bc = append_suffix_to_stem(&bitcodefile, "extract"); - let prog = config.llvm_bin_path.get_ref().join("llvm-extract"); + let prog = config.llvm_bin_path.as_ref().unwrap().join("llvm-extract"); let proc_args = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths prog: prog.as_str().unwrap().to_string(), @@ -1559,7 +1559,7 @@ fn disassemble_extract(config: &Config, _props: &TestProps, let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix); let extracted_bc = append_suffix_to_stem(&bitcodefile, "extract"); let extracted_ll = extracted_bc.with_extension("ll"); - let prog = config.llvm_bin_path.get_ref().join("llvm-dis"); + let prog = config.llvm_bin_path.as_ref().unwrap().join("llvm-dis"); let proc_args = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths prog: prog.as_str().unwrap().to_string(), diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index f212cdd463807..7346404731988 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -476,7 +476,7 @@ impl TypedArena { /// Grows the arena. #[inline(never)] fn grow(&self) { - let chunk = self.first.borrow_mut().take_unwrap(); + let chunk = self.first.borrow_mut().take().unwrap(); let new_capacity = chunk.capacity.checked_mul(&2).unwrap(); let chunk = TypedArenaChunk::::new(Some(chunk), new_capacity); self.ptr.set(chunk.start() as *const T); @@ -489,13 +489,13 @@ impl TypedArena { impl Drop for TypedArena { fn drop(&mut self) { // Determine how much was filled. - let start = self.first.borrow().get_ref().start() as uint; + let start = self.first.borrow().as_ref().unwrap().start() as uint; let end = self.ptr.get() as uint; let diff = (end - start) / mem::size_of::(); // Pass that to the `destroy` method. unsafe { - self.first.borrow_mut().get_mut_ref().destroy(diff) + self.first.borrow_mut().as_mut().unwrap().destroy(diff) } } } diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 418bb147d204a..22ac0a60c769b 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -630,7 +630,7 @@ impl<'a, A> MutItems<'a, A> { None => return self.list.push_front_node(ins_node), Some(prev) => prev, }; - let node_own = prev_node.next.take_unwrap(); + let node_own = prev_node.next.take().unwrap(); ins_node.next = link_with_prev(node_own, Rawlink::some(&mut *ins_node)); prev_node.next = link_with_prev(ins_node, Rawlink::some(prev_node)); self.list.length += 1; diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index 2f0fbfadb17f3..296383f39e85e 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -309,7 +309,7 @@ impl<'a, T> Iterator<&'a T> for Items<'a, T> { } let raw_index = raw_index(self.lo, self.elts.len(), self.index); self.index += 1; - Some(self.elts[raw_index].get_ref()) + Some(self.elts[raw_index].as_ref().unwrap()) } #[inline] @@ -327,7 +327,7 @@ impl<'a, T> DoubleEndedIterator<&'a T> for Items<'a, T> { } self.rindex -= 1; let raw_index = raw_index(self.lo, self.elts.len(), self.rindex); - Some(self.elts[raw_index].get_ref()) + Some(self.elts[raw_index].as_ref().unwrap()) } } @@ -343,7 +343,7 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> { None } else { let raw_index = raw_index(self.lo, self.elts.len(), self.index + j); - Some(self.elts[raw_index].get_ref()) + Some(self.elts[raw_index].as_ref().unwrap()) } } } diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index 8e5ffbd168660..9c049d975c5bf 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -1447,7 +1447,7 @@ impl TreeNode { // Remove left horizontal link by rotating right fn skew(node: &mut Box>) { if node.left.as_ref().map_or(false, |x| x.level == node.level) { - let mut save = node.left.take_unwrap(); + let mut save = node.left.take().unwrap(); swap(&mut node.left, &mut save.right); // save.right now None swap(node, &mut save); node.right = Some(save); @@ -1459,7 +1459,7 @@ fn skew(node: &mut Box>) { fn split(node: &mut Box>) { if node.right.as_ref().map_or(false, |x| x.right.as_ref().map_or(false, |y| y.level == node.level)) { - let mut save = node.right.take_unwrap(); + let mut save = node.right.take().unwrap(); swap(&mut node.right, &mut save.left); // save.left now None save.level += 1; swap(node, &mut save); @@ -1563,7 +1563,7 @@ fn remove(node: &mut Option>>, Equal => { if save.left.is_some() { if save.right.is_some() { - let mut left = save.left.take_unwrap(); + let mut left = save.left.take().unwrap(); if left.right.is_some() { heir_swap(save, &mut left.right); } else { @@ -1573,13 +1573,13 @@ fn remove(node: &mut Option>>, save.left = Some(left); (remove(&mut save.left, key), true) } else { - let new = save.left.take_unwrap(); + let new = save.left.take().unwrap(); let box TreeNode{value, ..} = replace(save, new); - *save = save.left.take_unwrap(); + *save = save.left.take().unwrap(); (Some(value), true) } } else if save.right.is_some() { - let new = save.right.take_unwrap(); + let new = save.right.take().unwrap(); let box TreeNode{value, ..} = replace(save, new); (Some(value), true) } else { diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 2a7b1630edf68..c24db8376710d 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -99,7 +99,7 @@ //! // Take a reference to the inside of cache cell //! let mut cache = self.span_tree_cache.borrow_mut(); //! if cache.is_some() { -//! return cache.get_ref().clone(); +//! return cache.as_ref().unwrap().clone(); //! } //! //! let span_tree = self.calc_span_tree(); diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b2bd8d46fb597..580d45ee8a6f9 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2191,7 +2191,12 @@ pub fn iterate<'a, T: Clone>(f: |T|: 'a -> T, seed: T) -> Iterate<'a, T> { if *first { *first = false; } else { - val.mutate(|x| (*f)(x)); + match val.take() { + Some(x) => { + *val = Some((*f)(x)) + } + None => {} + } } val.clone() }) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index dbcd943dae6d4..537d78a67feb2 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -341,7 +341,7 @@ impl Option { #[deprecated = "removed due to lack of use"] pub fn mutate(&mut self, f: |T| -> T) -> bool { if self.is_some() { - *self = Some(f(self.take_unwrap())); + *self = Some(f(self.take().unwrap())); true } else { false } } @@ -353,7 +353,7 @@ impl Option { #[deprecated = "removed due to lack of use"] pub fn mutate_or_set(&mut self, def: T, f: |T| -> T) -> bool { if self.is_some() { - *self = Some(f(self.take_unwrap())); + *self = Some(f(self.take().unwrap())); true } else { *self = Some(def); diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 776637f3be97d..2dad9fc3a22c4 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -73,7 +73,7 @@ fn test_option_dance() { let mut y = Some(5i); let mut y2 = 0; for _x in x.iter() { - y2 = y.take_unwrap(); + y2 = y.take().unwrap(); } assert_eq!(y2, 5); assert!(y.is_none()); @@ -82,8 +82,8 @@ fn test_option_dance() { #[test] #[should_fail] fn test_option_too_much_dance() { let mut y = Some(marker::NoCopy); - let _y2 = y.take_unwrap(); - let _y3 = y.take_unwrap(); + let _y2 = y.take().unwrap(); + let _y3 = y.take().unwrap(); } #[test] diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index c9af44c947925..90afee652646c 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -106,7 +106,7 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> Paths { let mut root = os::getcwd(); let pat_root = Path::new(pattern).root_path(); if pat_root.is_some() { - if check_windows_verbatim(pat_root.get_ref()) { + if check_windows_verbatim(pat_root.as_ref().unwrap()) { // FIXME: How do we want to handle verbatim paths? I'm inclined to return nothing, // since we can't very well find all UNC shares with a 1-letter server name. return Paths { @@ -116,7 +116,7 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> Paths { todo: Vec::new(), }; } - root.push(pat_root.get_ref()); + root.push(pat_root.as_ref().unwrap()); } let root_len = pat_root.map_or(0u, |p| p.as_vec().len()); diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index 5c280a31db792..cc77d151231e8 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -305,7 +305,7 @@ pub fn start(argc: int, argv: *const *const u8, let mut main = Some(main); let mut ret = None; simple::task().run(|| { - ret = Some(run(event_loop_factory, main.take_unwrap())); + ret = Some(run(event_loop_factory, main.take().unwrap())); }).destroy(); // unsafe is ok b/c we're sure that the runtime is gone unsafe { rt::cleanup() } diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index 22001cf107017..084a66fdddf15 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -203,7 +203,7 @@ impl Scheduler { let mut sched_task = self.run(sched_task); // Close the idle callback. - let mut sched = sched_task.sched.take_unwrap(); + let mut sched = sched_task.sched.take().unwrap(); sched.idle_callback.take(); // Make one go through the loop to run the close callback. let mut stask = sched.run(sched_task); @@ -702,7 +702,7 @@ impl Scheduler { assert!(sched.sched_task.is_none()); sched.sched_task = Some(stask); }); - (cur.sched.take_unwrap(), cur) + (cur.sched.take().unwrap(), cur) } fn resume_task_immediately_cl(sched: Box, @@ -738,7 +738,7 @@ impl Scheduler { f: |&mut Scheduler, BlockedTask|) { // Trickier - we need to get the scheduler task out of self // and use it as the destination. - let stask = self.sched_task.take_unwrap(); + let stask = self.sched_task.take().unwrap(); // Otherwise this is the same as below. self.switch_running_tasks_and_then(cur, stask, f) } @@ -788,7 +788,7 @@ impl Scheduler { sched.enqueue_task(last_task); } }); - (cur.sched.take_unwrap(), cur) + (cur.sched.take().unwrap(), cur) } // * Task Context Helpers @@ -800,9 +800,9 @@ impl Scheduler { -> ! { // Similar to deschedule running task and then, but cannot go through // the task-blocking path. The task is already dying. - let stask = self.sched_task.take_unwrap(); + let stask = self.sched_task.take().unwrap(); let _cur = self.change_task_context(cur, stask, |sched, mut dead_task| { - let coroutine = dead_task.coroutine.take_unwrap(); + let coroutine = dead_task.coroutine.take().unwrap(); coroutine.recycle(&mut sched.stack_pool); sched.task_state.decrement(); }); @@ -818,7 +818,7 @@ impl Scheduler { } pub fn run_task_later(mut cur: Box, next: Box) { - let mut sched = cur.sched.take_unwrap(); + let mut sched = cur.sched.take().unwrap(); sched.enqueue_task(next); cur.put_with_sched(sched); } @@ -838,7 +838,7 @@ impl Scheduler { self.yield_check_count = reset_yield_check(&mut self.rng); // Tell the scheduler to start stealing on the next iteration self.steal_for_yield = true; - let stask = self.sched_task.take_unwrap(); + let stask = self.sched_task.take().unwrap(); let cur = self.change_task_context(cur, stask, |sched, task| { sched.enqueue_task(task); }); @@ -878,7 +878,7 @@ impl Scheduler { pub fn sched_id(&self) -> uint { self as *const Scheduler as uint } pub fn run_cleanup_job(&mut self) { - let cleanup_job = self.cleanup_job.take_unwrap(); + let cleanup_job = self.cleanup_job.take().unwrap(); cleanup_job.run(self) } @@ -1235,7 +1235,7 @@ mod test { fn run(next: Box) { let mut task = GreenTask::convert(Local::take()); - let sched = task.sched.take_unwrap(); + let sched = task.sched.take().unwrap(); sched.run_task(task, next) } diff --git a/src/libgreen/task.rs b/src/libgreen/task.rs index 73fe8f6a93f82..28e1e94e807b3 100644 --- a/src/libgreen/task.rs +++ b/src/libgreen/task.rs @@ -110,7 +110,7 @@ extern fn bootstrap_green_task(task: uint, code: *mut (), env: *mut ()) -> ! { // requested. This is the "try/catch" block for this green task and // is the wrapper for *all* code run in the task. let mut start = Some(start); - let task = task.swap().run(|| start.take_unwrap()()).destroy(); + let task = task.swap().run(|| start.take().unwrap()()).destroy(); // Once the function has exited, it's time to run the termination // routine. This means we need to context switch one more time but @@ -212,7 +212,7 @@ impl GreenTask { pub fn take_unwrap_home(&mut self) -> Home { match self.task_type { - TypeGreen(ref mut home) => home.take_unwrap(), + TypeGreen(ref mut home) => home.take().unwrap(), TypeSched => rtabort!("type error: used SchedTask as GreenTask"), } } @@ -277,7 +277,7 @@ impl GreenTask { } pub fn swap(mut self: Box) -> Box { - let mut task = self.task.take_unwrap(); + let mut task = self.task.take().unwrap(); task.put_runtime(self); return task; } @@ -288,7 +288,7 @@ impl GreenTask { } fn terminate(mut self: Box) -> ! { - let sched = self.sched.take_unwrap(); + let sched = self.sched.take().unwrap(); sched.terminate_current_task(self) } @@ -324,13 +324,13 @@ impl GreenTask { impl Runtime for GreenTask { fn yield_now(mut self: Box, cur_task: Box) { self.put_task(cur_task); - let sched = self.sched.take_unwrap(); + let sched = self.sched.take().unwrap(); sched.yield_now(self); } fn maybe_yield(mut self: Box, cur_task: Box) { self.put_task(cur_task); - let sched = self.sched.take_unwrap(); + let sched = self.sched.take().unwrap(); sched.maybe_yield(self); } @@ -339,7 +339,7 @@ impl Runtime for GreenTask { cur_task: Box, f: |BlockedTask| -> Result<(), BlockedTask>) { self.put_task(cur_task); - let mut sched = self.sched.take_unwrap(); + let mut sched = self.sched.take().unwrap(); // In order for this task to be reawoken in all possible contexts, we // may need a handle back in to the current scheduler. When we're woken @@ -418,7 +418,7 @@ impl Runtime for GreenTask { match running_task.maybe_take_runtime::() { Some(mut running_green_task) => { running_green_task.put_task(running_task); - let sched = running_green_task.sched.take_unwrap(); + let sched = running_green_task.sched.take().unwrap(); if sched.pool_id == self.pool_id { sched.run_task(running_green_task, self); diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index 06d48f2f886b8..06b78a54e53ee 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -119,7 +119,7 @@ fn helper(input: libc::c_int, messages: Receiver, _: ()) { let mut timer = match active.shift() { Some(timer) => timer, None => return }; - let mut cb = timer.cb.take_unwrap(); + let mut cb = timer.cb.take().unwrap(); cb.call(); if timer.repeat { timer.cb = Some(cb); diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index c7b89b6cb9153..06f89d38ca0a1 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -139,7 +139,7 @@ pub fn start(argc: int, argv: *const *const u8, main: proc()) -> int { unsafe { rt::stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top); } - exit_code = Some(run(main.take_unwrap())); + exit_code = Some(run(main.take().unwrap())); }).destroy()); unsafe { rt::cleanup(); } // If the exit code wasn't set, then the task block must have failed. diff --git a/src/libnative/task.rs b/src/libnative/task.rs index 55806caaf1352..3109fd8458187 100644 --- a/src/libnative/task.rs +++ b/src/libnative/task.rs @@ -92,7 +92,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc():Send) { let mut f = Some(f); let mut task = task; task.put_runtime(ops); - drop(task.run(|| { f.take_unwrap()() }).destroy()); + drop(task.run(|| { f.take().unwrap()() }).destroy()); drop(token); }) } diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 261d4be86b406..e07132b1f9cca 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -223,7 +223,7 @@ pub fn phase_2_configure_and_expand(sess: &Session, let mut addl_plugins = Some(addl_plugins); let Plugins { macros, registrars } = time(time_passes, "plugin loading", (), |_| - plugin::load::load_plugins(sess, &krate, addl_plugins.take_unwrap())); + plugin::load::load_plugins(sess, &krate, addl_plugins.take().unwrap())); let mut registry = Registry::new(&krate); diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index cf018927f70b4..8952e565008e8 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -207,7 +207,7 @@ pub struct Context<'a> { macro_rules! run_lints ( ($cx:expr, $f:ident, $($args:expr),*) => ({ // Move the vector of passes out of `$cx` so that we can // iterate over it mutably while passing `$cx` to the methods. - let mut passes = $cx.lints.passes.take_unwrap(); + let mut passes = $cx.lints.passes.take().unwrap(); for obj in passes.mut_iter() { obj.$f($cx, $($args),*); } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 8968c8cc2599f..f05602bbb58c8 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -166,7 +166,7 @@ impl<'a> Drop for StatRecorder<'a> { let end = time::precise_time_ns(); let elapsed = ((end - self.start) / 1_000_000) as uint; let iend = self.ccx.stats.n_llvm_insns.get(); - self.ccx.stats.fn_stats.borrow_mut().push((self.name.take_unwrap(), + self.ccx.stats.fn_stats.borrow_mut().push((self.name.take().unwrap(), elapsed, iend - self.istart)); self.ccx.stats.n_fns.set(self.ccx.stats.n_fns.get() + 1); diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index e19ee035a781e..f2a7f1dc4f8ee 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -147,7 +147,7 @@ pub fn monomorphic_fn(ccx: &CrateContext, decl_internal_rust_fn(ccx, mono_ty, s.as_slice()) }; - ccx.monomorphized.borrow_mut().insert(hash_id.take_unwrap(), lldecl); + ccx.monomorphized.borrow_mut().insert(hash_id.take().unwrap(), lldecl); lldecl }; diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 445672fcdc4d8..76ab164bc2d3a 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -108,7 +108,7 @@ fn try_inline_def(cx: &core::DocContext, _ => return None, }; let fqn = csearch::get_item_path(tcx, did); - cx.inlined.borrow_mut().get_mut_ref().insert(did); + cx.inlined.borrow_mut().as_mut().unwrap().insert(did); ret.push(clean::Item { source: clean::Span::empty(), name: Some(fqn.last().unwrap().to_string()), @@ -142,7 +142,7 @@ pub fn record_extern_fqn(cx: &core::DocContext, core::Typed(ref tcx) => { let fqn = csearch::get_item_path(tcx, did); let fqn = fqn.move_iter().map(|i| i.to_string()).collect(); - cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, kind)); + cx.external_paths.borrow_mut().as_mut().unwrap().insert(did, (fqn, kind)); } core::NotTyped(..) => {} } @@ -278,7 +278,7 @@ fn build_impls(cx: &core::DocContext, fn build_impl(cx: &core::DocContext, tcx: &ty::ctxt, did: ast::DefId) -> Option { - if !cx.inlined.borrow_mut().get_mut_ref().insert(did) { + if !cx.inlined.borrow_mut().as_mut().unwrap().insert(did) { return None } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index dc2c0d1d0830d..0516f533ffe4c 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -468,7 +468,7 @@ impl Clean for ast::TyParam { impl Clean for ty::TypeParameterDef { fn clean(&self) -> TyParam { - get_cx().external_typarams.borrow_mut().get_mut_ref() + get_cx().external_typarams.borrow_mut().as_mut().unwrap() .insert(self.def_id, self.ident.clean()); TyParam { name: self.ident.clean(), @@ -541,8 +541,8 @@ impl Clean for ty::BuiltinBound { }; let fqn = csearch::get_item_path(tcx, did); let fqn = fqn.move_iter().map(|i| i.to_string()).collect(); - cx.external_paths.borrow_mut().get_mut_ref().insert(did, - (fqn, TypeTrait)); + cx.external_paths.borrow_mut().as_mut().unwrap().insert(did, + (fqn, TypeTrait)); TraitBound(ResolvedPath { path: path, typarams: None, @@ -563,7 +563,7 @@ impl Clean for ty::TraitRef { .collect::>(); let path = external_path(fqn.last().unwrap().as_slice(), &self.substs); - cx.external_paths.borrow_mut().get_mut_ref().insert(self.def_id, + cx.external_paths.borrow_mut().as_mut().unwrap().insert(self.def_id, (fqn, TypeTrait)); TraitBound(ResolvedPath { path: path, @@ -1294,7 +1294,7 @@ impl Clean for ty::t { }; let path = external_path(fqn.last().unwrap().to_string().as_slice(), substs); - get_cx().external_paths.borrow_mut().get_mut_ref() + get_cx().external_paths.borrow_mut().as_mut().unwrap() .insert(did, (fqn, kind)); ResolvedPath { path: path, @@ -2086,7 +2086,7 @@ fn register_def(cx: &core::DocContext, def: def::Def) -> ast::DefId { match kind { TypeTrait => { let t = inline::build_external_trait(tcx, did); - cx.external_traits.borrow_mut().get_mut_ref().insert(did, t); + cx.external_traits.borrow_mut().as_mut().unwrap().insert(did, t); } _ => {} } @@ -2153,7 +2153,7 @@ fn lang_struct(did: Option, t: ty::t, name: &str, let fqn: Vec = fqn.move_iter().map(|i| { i.to_string() }).collect(); - get_cx().external_paths.borrow_mut().get_mut_ref() + get_cx().external_paths.borrow_mut().as_mut().unwrap() .insert(did, (fqn, TypeStruct)); ResolvedPath { typarams: None, diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 6415ee85f5704..c2caa474f9fb1 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -297,7 +297,7 @@ pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) -> let public_items = public_items.unwrap_or(NodeSet::new()); let paths: HashMap, ItemType)> = analysis.as_ref().map(|a| { - let paths = a.external_paths.borrow_mut().take_unwrap(); + let paths = a.external_paths.borrow_mut().take().unwrap(); paths.move_iter().map(|(k, (v, t))| { (k, (v, match t { clean::TypeStruct => item_type::Struct, @@ -325,13 +325,13 @@ pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) -> public_items: public_items, orphan_methods: Vec::new(), traits: analysis.as_ref().map(|a| { - a.external_traits.borrow_mut().take_unwrap() + a.external_traits.borrow_mut().take().unwrap() }).unwrap_or(HashMap::new()), typarams: analysis.as_ref().map(|a| { - a.external_typarams.borrow_mut().take_unwrap() + a.external_typarams.borrow_mut().take().unwrap() }).unwrap_or(HashMap::new()), inlined: analysis.as_ref().map(|a| { - a.inlined.borrow_mut().take_unwrap() + a.inlined.borrow_mut().take().unwrap() }).unwrap_or(HashSet::new()), }; cache.stack.push(krate.name.clone()); @@ -805,7 +805,7 @@ impl DocFolder for Cache { v.push(Implementor { def_id: item.def_id, generics: i.generics.clone(), - trait_: i.trait_.get_ref().clone(), + trait_: i.trait_.as_ref().unwrap().clone(), for_: i.for_.clone(), stability: item.stability.clone(), }); @@ -878,7 +878,7 @@ impl DocFolder for Cache { // Keep track of the fully qualified path for this item. let pushed = if item.name.is_some() { - let n = item.name.get_ref(); + let n = item.name.as_ref().unwrap(); if n.len() > 0 { self.stack.push(n.to_string()); true @@ -1125,7 +1125,7 @@ impl Context { if title.len() > 0 { title.push_str("::"); } - title.push_str(it.name.get_ref().as_slice()); + title.push_str(it.name.as_ref().unwrap().as_slice()); } title.push_str(" - Rust"); let tyname = shortty(it).to_static_str(); @@ -1191,10 +1191,10 @@ impl Context { // modules are special because they add a namespace. We also need to // recurse into the items of the module as well. clean::ModuleItem(..) => { - let name = item.name.get_ref().to_string(); + let name = item.name.as_ref().unwrap().to_string(); let mut item = Some(item); self.recurse(name, |this| { - let item = item.take_unwrap(); + let item = item.take().unwrap(); let dst = this.dst.join("index.html"); let dst = try!(File::create(&dst)); try!(render(dst, this, &item, false)); @@ -1398,7 +1398,7 @@ fn item_path(item: &clean::Item) -> String { fn full_path(cx: &Context, item: &clean::Item) -> String { let mut s = cx.current.connect("::"); s.push_str("::"); - s.push_str(item.name.get_ref().as_slice()); + s.push_str(item.name.as_ref().unwrap().as_slice()); return s } @@ -1809,7 +1809,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item, try!(write!(w, " {{\n")); for v in e.variants.iter() { try!(write!(w, " ")); - let name = v.name.get_ref().as_slice(); + let name = v.name.as_ref().unwrap().as_slice(); match v.inner { clean::VariantItem(ref var) => { match var.kind { @@ -2098,7 +2098,7 @@ impl<'a> fmt::Show for Sidebar<'a> { try!(write!(w, "

{}

", short, longty)); for item in items.iter() { let curty = shortty(cur).to_static_str(); - let class = if cur.name.get_ref() == item && + let class = if cur.name.as_ref().unwrap() == item && short == curty { "current" } else { "" }; try!(write!(w, "\ {name}", diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index fb1666bef0d2f..2f140aa8a6802 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -385,7 +385,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche // Process all of the crate attributes, extracting plugin metadata along // with the passes which we are supposed to run. - match krate.module.get_ref().doc_list() { + match krate.module.as_ref().unwrap().doc_list() { Some(nested) => { for inner in nested.iter() { match *inner { diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index acd53535e3bee..30a6b1f56e03a 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -384,7 +384,7 @@ impl Task { // function, and I would be saddened if more usage of the function // crops up. unsafe { - let imp = self.imp.take_unwrap(); + let imp = self.imp.take().unwrap(); let vtable = mem::transmute::<_, &raw::TraitObject>(&imp).vtable; match imp.wrap().downcast::() { Ok(t) => Some(t), @@ -407,7 +407,7 @@ impl Task { pub fn spawn_sibling(mut self: Box, opts: TaskOpts, f: proc(): Send) { - let ops = self.imp.take_unwrap(); + let ops = self.imp.take().unwrap(); ops.spawn_sibling(self, opts, f) } @@ -417,7 +417,7 @@ impl Task { pub fn deschedule(mut self: Box, amt: uint, f: |BlockedTask| -> ::core::result::Result<(), BlockedTask>) { - let ops = self.imp.take_unwrap(); + let ops = self.imp.take().unwrap(); ops.deschedule(amt, self, f) } @@ -425,7 +425,7 @@ impl Task { /// current task can accept a change in scheduling. This function can only /// be called on tasks that were previously blocked in `deschedule`. pub fn reawaken(mut self: Box) { - let ops = self.imp.take_unwrap(); + let ops = self.imp.take().unwrap(); ops.reawaken(self); } @@ -433,14 +433,14 @@ impl Task { /// eventually return, but possibly not immediately. This is used as an /// opportunity to allow other tasks a chance to run. pub fn yield_now(mut self: Box) { - let ops = self.imp.take_unwrap(); + let ops = self.imp.take().unwrap(); ops.yield_now(self); } /// Similar to `yield_now`, except that this function may immediately return /// without yielding (depending on what the runtime decides to do). pub fn maybe_yield(mut self: Box) { - let ops = self.imp.take_unwrap(); + let ops = self.imp.take().unwrap(); ops.maybe_yield(self); } @@ -448,20 +448,20 @@ impl Task { /// stored in the task's runtime. This factory may not always be available, /// which is why the return type is `Option` pub fn local_io<'a>(&'a mut self) -> Option> { - self.imp.get_mut_ref().local_io() + self.imp.as_mut().unwrap().local_io() } /// Returns the stack bounds for this task in (lo, hi) format. The stack /// bounds may not be known for all tasks, so the return value may be /// `None`. pub fn stack_bounds(&self) -> (uint, uint) { - self.imp.get_ref().stack_bounds() + self.imp.as_ref().unwrap().stack_bounds() } /// Returns whether it is legal for this task to block the OS thread that it /// is running on. pub fn can_block(&self) -> bool { - self.imp.get_ref().can_block() + self.imp.as_ref().unwrap().can_block() } /// Consume this task, flagging it as a candidate for destruction. diff --git a/src/librustrt/thread.rs b/src/librustrt/thread.rs index 43364466dbe39..1f0b0c7c207bf 100644 --- a/src/librustrt/thread.rs +++ b/src/librustrt/thread.rs @@ -128,7 +128,7 @@ impl Thread { unsafe { imp::join(self.native) }; self.joined = true; assert!(self.packet.is_some()); - self.packet.take_unwrap() + self.packet.take().unwrap() } } diff --git a/src/librustuv/addrinfo.rs b/src/librustuv/addrinfo.rs index 6eaab1c096170..8b41219db62f1 100644 --- a/src/librustuv/addrinfo.rs +++ b/src/librustuv/addrinfo.rs @@ -86,7 +86,7 @@ impl GetAddrInfoRequest { }); match cx.status { - 0 => Ok(accum_addrinfo(cx.addrinfo.get_ref())), + 0 => Ok(accum_addrinfo(cx.addrinfo.as_ref().unwrap())), n => Err(UvError(n)) } } diff --git a/src/librustuv/async.rs b/src/librustuv/async.rs index 97f95145b8992..8bed4cfb8114b 100644 --- a/src/librustuv/async.rs +++ b/src/librustuv/async.rs @@ -136,7 +136,7 @@ mod test_remote { // once let MyCallback(ref mut s) = *self; if s.is_some() { - s.take_unwrap().send(1); + s.take().unwrap().send(1); } } } diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs index 6e948992979d8..561a4dffe82f2 100644 --- a/src/librustuv/lib.rs +++ b/src/librustuv/lib.rs @@ -259,7 +259,7 @@ fn wait_until_woken_after(slot: *mut Option, fn wakeup(slot: &mut Option) { assert!(slot.is_some()); - let _ = slot.take_unwrap().wake().map(|t| t.reawaken()); + let _ = slot.take().unwrap().wake().map(|t| t.reawaken()); } pub struct Request { diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs index 84ef9deaf922f..09d008a9fa904 100644 --- a/src/librustuv/net.rs +++ b/src/librustuv/net.rs @@ -596,7 +596,7 @@ impl rtio::RtioUdpSocket for UdpWatcher { wait_until_woken_after(&mut cx.task, &loop_, || { unsafe { uvll::set_data_for_uv_handle(handle, &mut cx) } }); - match cx.result.take_unwrap() { + match cx.result.take().unwrap() { (n, _) if n < 0 => Err(uv_error_to_io_error(UvError(n as c_int))), (n, addr) => Ok((n as uint, addr.unwrap())) @@ -657,7 +657,7 @@ impl rtio::RtioUdpSocket for UdpWatcher { // here. let data = if guard.can_timeout {Some(Vec::from_slice(buf))} else {None}; let uv_buf = if guard.can_timeout { - slice_to_uv_buf(data.get_ref().as_slice()) + slice_to_uv_buf(data.as_ref().unwrap().as_slice()) } else { slice_to_uv_buf(buf) }; diff --git a/src/librustuv/process.rs b/src/librustuv/process.rs index 0486f376bc806..4a12f959ad9a5 100644 --- a/src/librustuv/process.rs +++ b/src/librustuv/process.rs @@ -297,7 +297,7 @@ impl rtio::RtioProcess for Process { self.timer = Some(timer); } - let timer = self.timer.get_mut_ref(); + let timer = self.timer.as_mut().unwrap(); timer.stop(); timer.start(timer_cb, ms, 0); self.timeout_state = TimeoutPending; diff --git a/src/librustuv/stream.rs b/src/librustuv/stream.rs index c49e557a3237d..12831002b65ec 100644 --- a/src/librustuv/stream.rs +++ b/src/librustuv/stream.rs @@ -161,7 +161,7 @@ impl StreamWatcher { // bytes. let data = if may_timeout {Some(Vec::from_slice(buf))} else {None}; let uv_buf = if may_timeout { - slice_to_uv_buf(data.get_ref().as_slice()) + slice_to_uv_buf(data.as_ref().unwrap().as_slice()) } else { slice_to_uv_buf(buf) }; diff --git a/src/librustuv/timeout.rs b/src/librustuv/timeout.rs index 32d7395241675..0fc5772c18808 100644 --- a/src/librustuv/timeout.rs +++ b/src/librustuv/timeout.rs @@ -140,7 +140,7 @@ impl AccessTimeout { self.timer = Some(timer); } - let timer = self.timer.get_mut_ref(); + let timer = self.timer.as_mut().unwrap(); unsafe { let cx = uvll::get_data_for_uv_handle(timer.handle); let cx = cx as *mut TimerContext; diff --git a/src/librustuv/timer.rs b/src/librustuv/timer.rs index f6c1cdd297754..412506604c674 100644 --- a/src/librustuv/timer.rs +++ b/src/librustuv/timer.rs @@ -132,9 +132,9 @@ extern fn timer_cb(handle: *mut uvll::uv_timer_t) { let _f = ForbidSwitch::new("timer callback can't switch"); let timer: &mut TimerWatcher = unsafe { UvHandle::from_uv_handle(&handle) }; - match timer.action.take_unwrap() { + match timer.action.take().unwrap() { WakeTask => { - let task = timer.blocker.take_unwrap(); + let task = timer.blocker.take().unwrap(); let _ = task.wake().map(|t| t.reawaken()); } CallOnce(mut cb) => { cb.call() } diff --git a/src/librustuv/uvio.rs b/src/librustuv/uvio.rs index 61e52a3abd19c..30b172c5b6bf0 100644 --- a/src/librustuv/uvio.rs +++ b/src/librustuv/uvio.rs @@ -66,7 +66,7 @@ impl Drop for UvEventLoop { // Lastly, after we've closed the pool of handles we pump the event loop // one last time to run any closing callbacks to make sure the loop // shuts down cleanly. - let handle = self.uvio.handle_pool.get_ref().handle(); + let handle = self.uvio.handle_pool.as_ref().unwrap().handle(); drop(self.uvio.handle_pool.take()); self.run(); @@ -132,7 +132,7 @@ impl UvIoFactory { // It's understood by the homing code that the "local id" is just the // pointer of the local I/O factory cast to a uint. let id: uint = unsafe { mem::transmute_copy(&self) }; - HomeHandle::new(id, &mut **self.handle_pool.get_mut_ref()) + HomeHandle::new(id, &mut **self.handle_pool.as_mut().unwrap()) } } diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 1d638e498d449..0c63f1a901f5a 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -182,7 +182,7 @@ impl BufferedWriter { pub fn unwrap(mut self) -> W { // FIXME(#12628): is failing the right thing to do if flushing fails? self.flush_buf().unwrap(); - self.inner.take_unwrap() + self.inner.take().unwrap() } } diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index dd6c1f6016c50..c1f4161fe181f 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -54,7 +54,7 @@ use collections::HashMap; /// Err(e) => fail!("failed to execute child: {}", e), /// }; /// -/// let contents = child.stdout.get_mut_ref().read_to_end(); +/// let contents = child.stdout.as_mut().unwrap().read_to_end(); /// assert!(child.wait().unwrap().success()); /// ``` pub struct Process { @@ -95,7 +95,7 @@ pub type EnvMap = HashMap; /// Err(e) => fail!("failed to execute process: {}", e), /// }; /// -/// let output = process.stdout.get_mut_ref().read_to_end(); +/// let output = process.stdout.as_mut().unwrap().read_to_end(); /// ``` #[deriving(Clone)] pub struct Command { diff --git a/src/libstd/io/tempfile.rs b/src/libstd/io/tempfile.rs index 2faa23a6aa0a5..8def5d5c99752 100644 --- a/src/libstd/io/tempfile.rs +++ b/src/libstd/io/tempfile.rs @@ -70,7 +70,7 @@ impl TempDir { /// temporary directory is prevented. pub fn unwrap(self) -> Path { let mut tmpdir = self; - tmpdir.path.take_unwrap() + tmpdir.path.take().unwrap() } /// Access the wrapped `std::path::Path` to the temporary directory. diff --git a/src/libsync/comm/oneshot.rs b/src/libsync/comm/oneshot.rs index 188bea83ac80f..5b3cf33ebf093 100644 --- a/src/libsync/comm/oneshot.rs +++ b/src/libsync/comm/oneshot.rs @@ -107,7 +107,7 @@ impl Packet { // Couldn't send the data, the port hung up first. Return the data // back up the stack. DISCONNECTED => { - Err(self.data.take_unwrap()) + Err(self.data.take().unwrap()) } // Not possible, these are one-use channels @@ -244,7 +244,7 @@ impl Packet { // There's data on the channel, so make sure we destroy it promptly. // This is why not using an arc is a little difficult (need the box // to stay valid while we take the data). - DATA => { self.data.take_unwrap(); } + DATA => { self.data.take().unwrap(); } // We're the only ones that can block on this port _ => unreachable!() diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs index 1ee9fef191866..528a15cf6d765 100644 --- a/src/libsync/comm/sync.rs +++ b/src/libsync/comm/sync.rs @@ -347,7 +347,7 @@ impl Packet { let waiter = match mem::replace(&mut state.blocker, NoneBlocked) { NoneBlocked => None, BlockedSender(task) => { - *state.canceled.take_unwrap() = true; + *state.canceled.take().unwrap() = true; Some(task) } BlockedReceiver(..) => unreachable!(), @@ -434,7 +434,7 @@ impl Buffer { let start = self.start; self.size -= 1; self.start = (self.start + 1) % self.buf.len(); - self.buf.get_mut(start).take_unwrap() + self.buf.get_mut(start).take().unwrap() } fn size(&self) -> uint { self.size } @@ -481,7 +481,7 @@ impl Queue { } unsafe { (*node).next = 0 as *mut Node; - Some((*node).task.take_unwrap()) + Some((*node).task.take().unwrap()) } } } diff --git a/src/libsync/mpsc_queue.rs b/src/libsync/mpsc_queue.rs index 012574808f3c6..ad2539fc26008 100644 --- a/src/libsync/mpsc_queue.rs +++ b/src/libsync/mpsc_queue.rs @@ -122,7 +122,7 @@ impl Queue { *self.tail.get() = next; assert!((*tail).value.is_none()); assert!((*next).value.is_some()); - let ret = (*next).value.take_unwrap(); + let ret = (*next).value.take().unwrap(); let _: Box> = mem::transmute(tail); return Data(ret); } diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index c42d567fc18ce..ba6d0f03d8397 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -259,7 +259,7 @@ impl<'a> Condvar<'a> { // signaller already sent -- I mean 'unconditionally' in contrast // with acquire().) (|| { - let _ = wait_end.take_unwrap().recv(); + let _ = wait_end.take().unwrap().recv(); }).finally(|| { // Reacquire the condvar. match self.order { @@ -318,7 +318,7 @@ impl<'a> Condvar<'a> { condvar_id, "cond.signal_on()", || { - queue.take_unwrap().broadcast() + queue.take().unwrap().broadcast() }) } } diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index c71cf5557e35f..88f9c2b4ce39d 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -245,7 +245,7 @@ impl<'a> Iterator<&'a str> for Graphemes<'a> { // looking up each character twice. cat = match self.cat { None => gr::grapheme_category(ch), - _ => self.cat.take_unwrap() + _ => self.cat.take().unwrap() }; if match cat { @@ -345,7 +345,7 @@ impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> { // cached category, if any cat = match self.catb { None => gr::grapheme_category(ch), - _ => self.catb.take_unwrap() + _ => self.catb.take().unwrap() }; // a matching state machine that runs *backwards* across an input string diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index a0ff7736b5c7f..ebd5aa4b37bec 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -52,8 +52,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) { // Send/Receive lots of messages. for j in range(0u, count) { //println!("task %?, iter %?", i, j); - let num_chan2 = num_chan.take_unwrap(); - let num_port2 = num_port.take_unwrap(); + let num_chan2 = num_chan.take().unwrap(); + let num_port2 = num_port.take().unwrap(); send(&num_chan2, i * j); num_chan = Some(num_chan2); let _n = recv(&num_port2); diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs index 6512ecfb3e260..764d80984c304 100644 --- a/src/test/bench/msgsend-ring-rw-arcs.rs +++ b/src/test/bench/msgsend-ring-rw-arcs.rs @@ -52,8 +52,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) { // Send/Receive lots of messages. for j in range(0u, count) { //println!("task %?, iter %?", i, j); - let num_chan2 = num_chan.take_unwrap(); - let num_port2 = num_port.take_unwrap(); + let num_chan2 = num_chan.take().unwrap(); + let num_port2 = num_port.take().unwrap(); send(&num_chan2, i * j); num_chan = Some(num_chan2); let _n = recv(&num_port2);