diff options
| author | bors <bors@rust-lang.org> | 2014-08-28 23:56:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-08-28 23:56:20 +0000 |
| commit | 2e92c67dc0318a52fe42c3c0bca408f76c7feb61 (patch) | |
| tree | 1a90b5802f53f36eda0212ac1b02ebd521161f25 /src/librustrt | |
| parent | 1a33d7a54170cd2904cebc7a6fd2d1da471ff64e (diff) | |
| parent | 9a8233d3772fbdb3d496aac3e4693e6d4c30e125 (diff) | |
| download | rust-2e92c67dc0318a52fe42c3c0bca408f76c7feb61.tar.gz rust-2e92c67dc0318a52fe42c3c0bca408f76c7feb61.zip | |
auto merge of #16664 : aturon/rust/stabilize-option-result, r=alexcrichton
Per API meeting https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md # Changes to `core::option` Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues. However, a few methods have been deprecated, either due to lack of use or redundancy: * `take_unwrap`, `get_ref` and `get_mut_ref` (redundant, and we prefer for this functionality to go through an explicit .unwrap) * `filtered` and `while` * `mutate` and `mutate_or_set` * `collect`: this functionality is being moved to a new `FromIterator` impl. # Changes to `core::result` Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues. * `collect`: this functionality is being moved to a new `FromIterator` impl. * `fold_` is deprecated due to lack of use * Several methods found in `core::option` are added here, including `iter`, `as_slice`, and variants. Due to deprecations, this is a: [breaking-change]
Diffstat (limited to 'src/librustrt')
| -rw-r--r-- | src/librustrt/task.rs | 18 | ||||
| -rw-r--r-- | src/librustrt/thread.rs | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index e39071864a7..9d921943313 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::<T>() { Ok(t) => Some(t), @@ -407,7 +407,7 @@ impl Task { pub fn spawn_sibling(mut self: Box<Task>, 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<Task>, 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<Task>) { - 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<Task>) { - 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<Task>) { - 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<LocalIo<'a>> { - 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 43364466dbe..1f0b0c7c207 100644 --- a/src/librustrt/thread.rs +++ b/src/librustrt/thread.rs @@ -128,7 +128,7 @@ impl<T: Send> Thread<T> { unsafe { imp::join(self.native) }; self.joined = true; assert!(self.packet.is_some()); - self.packet.take_unwrap() + self.packet.take().unwrap() } } |
