diff options
Diffstat (limited to 'src/libsync')
| -rw-r--r-- | src/libsync/comm/mod.rs | 82 | ||||
| -rw-r--r-- | src/libsync/comm/oneshot.rs | 4 | ||||
| -rw-r--r-- | src/libsync/comm/select.rs | 26 | ||||
| -rw-r--r-- | src/libsync/comm/shared.rs | 4 | ||||
| -rw-r--r-- | src/libsync/comm/sync.rs | 4 | ||||
| -rw-r--r-- | src/libsync/deque.rs | 16 | ||||
| -rw-r--r-- | src/libsync/lock.rs | 32 | ||||
| -rw-r--r-- | src/libsync/mpsc_queue.rs | 2 | ||||
| -rw-r--r-- | src/libsync/raw.rs | 35 | ||||
| -rw-r--r-- | src/libsync/spsc_queue.rs | 2 |
10 files changed, 105 insertions, 102 deletions
diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index ddfd1088a41..247f50d666e 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -46,13 +46,13 @@ //! ## Failure Propagation //! //! In addition to being a core primitive for communicating in rust, channels -//! are the points at which failure is propagated among tasks. Whenever the one +//! are the points at which panics are propagated among tasks. Whenever the one //! half of channel is closed, the other half will have its next operation -//! `fail!`. The purpose of this is to allow propagation of failure among tasks +//! `panic!`. The purpose of this is to allow propagation of panics among tasks //! that are linked to one another via channels. //! //! There are methods on both of senders and receivers to perform their -//! respective operations without failing, however. +//! respective operations without panicking, however. //! //! ## Runtime Requirements //! @@ -102,10 +102,10 @@ //! } //! ``` //! -//! Propagating failure: +//! Propagating panics: //! //! ```should_fail -//! // The call to recv() will fail!() because the channel has already hung +//! // The call to recv() will panic!() because the channel has already hung //! // up (or been deallocated) //! let (tx, rx) = channel::<int>(); //! drop(tx); @@ -506,7 +506,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { /// becomes "rendezvous channel" where each send will not return until a recv /// is paired with it. /// -/// As with asynchronous channels, all senders will fail in `send` if the +/// As with asynchronous channels, all senders will panic in `send` if the /// `Receiver` has been destroyed. /// /// # Example @@ -550,25 +550,25 @@ impl<T: Send> Sender<T> { /// /// Rust channels are infinitely buffered so this method will never block. /// - /// # Failure + /// # Panics /// - /// This function will fail if the other end of the channel has hung up. + /// This function will panic if the other end of the channel has hung up. /// This means that if the corresponding receiver has fallen out of scope, - /// this function will trigger a fail message saying that a message is + /// this function will trigger a panic message saying that a message is /// being sent on a closed channel. /// - /// Note that if this function does *not* fail, it does not mean that the + /// Note that if this function does *not* panic, it does not mean that the /// data will be successfully received. All sends are placed into a queue, /// so it is possible for a send to succeed (the other end is alive), but /// then the other end could immediately disconnect. /// - /// The purpose of this functionality is to propagate failure among tasks. - /// If failure is not desired, then consider using the `send_opt` method + /// The purpose of this functionality is to propagate panicks among tasks. + /// If a panic is not desired, then consider using the `send_opt` method #[experimental = "this function is being considered candidate for removal \ to adhere to the general guidelines of rust"] pub fn send(&self, t: T) { if self.send_opt(t).is_err() { - fail!("sending on a closed channel"); + panic!("sending on a closed channel"); } } @@ -585,9 +585,9 @@ impl<T: Send> Sender<T> { /// /// Like `send`, this method will never block. /// - /// # Failure + /// # Panics /// - /// This method will never fail, it will return the message back to the + /// This method will never panic, it will return the message back to the /// caller if the other end is disconnected /// /// # Example @@ -634,7 +634,7 @@ impl<T: Send> Sender<T> { } oneshot::UpDisconnected => (a, Err(t)), oneshot::UpWoke(task) => { - // This send cannot fail because the task is + // This send cannot panic because the task is // asleep (we're looking at it), so the receiver // can't go away. (*a.get()).send(t).ok().unwrap(); @@ -731,20 +731,20 @@ impl<T: Send> SyncSender<T> { /// time. If the buffer size is 0, however, it can be guaranteed that the /// receiver has indeed received the data if this function returns success. /// - /// # Failure + /// # Panics /// - /// Similarly to `Sender::send`, this function will fail if the + /// Similarly to `Sender::send`, this function will panic if the /// corresponding `Receiver` for this channel has disconnected. This - /// behavior is used to propagate failure among tasks. + /// behavior is used to propagate panics among tasks. /// - /// If failure is not desired, you can achieve the same semantics with the - /// `SyncSender::send_opt` method which will not fail if the receiver + /// If a panic is not desired, you can achieve the same semantics with the + /// `SyncSender::send_opt` method which will not panic if the receiver /// disconnects. #[experimental = "this function is being considered candidate for removal \ to adhere to the general guidelines of rust"] pub fn send(&self, t: T) { if self.send_opt(t).is_err() { - fail!("sending on a closed channel"); + panic!("sending on a closed channel"); } } @@ -756,9 +756,9 @@ impl<T: Send> SyncSender<T> { /// is returned back to the callee. This function is similar to `try_send`, /// except that it will block if the channel is currently full. /// - /// # Failure + /// # Panics /// - /// This function cannot fail. + /// This function cannot panic. #[unstable = "this function may be renamed to send() in the future"] pub fn send_opt(&self, t: T) -> Result<(), T> { unsafe { (*self.inner.get()).send(t) } @@ -774,9 +774,9 @@ impl<T: Send> SyncSender<T> { /// See `SyncSender::send` for notes about guarantees of whether the /// receiver has received the data or not if this function is successful. /// - /// # Failure + /// # Panics /// - /// This function cannot fail + /// This function cannot panic #[unstable = "the return type of this function is candidate for \ modification"] pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>> { @@ -814,13 +814,13 @@ impl<T: Send> Receiver<T> { /// on the channel from its paired `Sender` structure. This receiver will /// be woken up when data is ready, and the data will be returned. /// - /// # Failure + /// # Panics /// - /// Similar to channels, this method will trigger a task failure if the + /// Similar to channels, this method will trigger a task panic if the /// other end of the channel has hung up (been deallocated). The purpose of - /// this is to propagate failure among tasks. + /// this is to propagate panicks among tasks. /// - /// If failure is not desired, then there are two options: + /// If a panic is not desired, then there are two options: /// /// * If blocking is still desired, the `recv_opt` method will return `None` /// when the other end hangs up @@ -832,7 +832,7 @@ impl<T: Send> Receiver<T> { pub fn recv(&self) -> T { match self.recv_opt() { Ok(t) => t, - Err(()) => fail!("receiving on a closed channel"), + Err(()) => panic!("receiving on a closed channel"), } } @@ -845,7 +845,9 @@ impl<T: Send> Receiver<T> { /// This is useful for a flavor of "optimistic check" before deciding to /// block on a receiver. /// - /// This function cannot fail. + /// # Panics + /// + /// This function cannot panic. #[unstable = "the return type of this function may be altered"] pub fn try_recv(&self) -> Result<T, TryRecvError> { // If a thread is spinning in try_recv, we should take the opportunity @@ -899,15 +901,15 @@ impl<T: Send> Receiver<T> { } } - /// Attempt to wait for a value on this receiver, but does not fail if the + /// Attempt to wait for a value on this receiver, but does not panic if the /// corresponding channel has hung up. /// /// This implementation of iterators for ports will always block if there is - /// not data available on the receiver, but it will not fail in the case + /// not data available on the receiver, but it will not panic in the case /// that the channel has been deallocated. /// /// In other words, this function has the same semantics as the `recv` - /// method except for the failure aspect. + /// method except for the panic aspect. /// /// If the channel has hung up, then `Err` is returned. Otherwise `Ok` of /// the value found on the receiver is returned. @@ -947,7 +949,7 @@ impl<T: Send> Receiver<T> { } /// Returns an iterator which will block waiting for messages, but never - /// `fail!`. It will return `None` when the channel has hung up. + /// `panic!`. It will return `None` when the channel has hung up. #[unstable] pub fn iter<'a>(&'a self) -> Messages<'a, T> { Messages { rx: self } @@ -1191,7 +1193,7 @@ mod test { assert_eq!(rx.recv(), 1); } match rx.try_recv() { - Ok(..) => fail!(), + Ok(..) => panic!(), _ => {} } dtx.send(()); @@ -1287,7 +1289,7 @@ mod test { } #[should_fail]) test!(fn oneshot_single_thread_recv_chan_close() { - // Receiving on a closed chan will fail + // Receiving on a closed chan will panic let res = task::try(proc() { let (tx, rx) = channel::<int>(); drop(tx); @@ -1711,7 +1713,7 @@ mod sync_tests { assert_eq!(rx.recv(), 1); } match rx.try_recv() { - Ok(..) => fail!(), + Ok(..) => panic!(), _ => {} } dtx.send(()); @@ -1747,7 +1749,7 @@ mod sync_tests { } #[should_fail]) test!(fn oneshot_single_thread_recv_chan_close() { - // Receiving on a closed chan will fail + // Receiving on a closed chan will panic let res = task::try(proc() { let (tx, rx) = sync_channel::<int>(0); drop(tx); diff --git a/src/libsync/comm/oneshot.rs b/src/libsync/comm/oneshot.rs index 053b5dc4c8a..447585fb2e0 100644 --- a/src/libsync/comm/oneshot.rs +++ b/src/libsync/comm/oneshot.rs @@ -94,7 +94,7 @@ impl<T: Send> Packet<T> { // Sanity check match self.upgrade { NothingSent => {} - _ => fail!("sending on a oneshot that's already sent on "), + _ => panic!("sending on a oneshot that's already sent on "), } assert!(self.data.is_none()); self.data = Some(t); @@ -203,7 +203,7 @@ impl<T: Send> Packet<T> { let prev = match self.upgrade { NothingSent => NothingSent, SendUsed => SendUsed, - _ => fail!("upgrading again"), + _ => panic!("upgrading again"), }; self.upgrade = GoUp(up); diff --git a/src/libsync/comm/select.rs b/src/libsync/comm/select.rs index 669c1c958b8..f8266643084 100644 --- a/src/libsync/comm/select.rs +++ b/src/libsync/comm/select.rs @@ -102,7 +102,7 @@ pub trait Packet { impl Select { /// Creates a new selection structure. This set is initially empty and - /// `wait` will fail!() if called. + /// `wait` will panic!() if called. /// /// Usage of this struct directly can sometimes be burdensome, and usage is /// rather much easier through the `select!` macro. @@ -353,17 +353,17 @@ mod test { tx1.send(1); select! ( foo = rx1.recv() => { assert_eq!(foo, 1); }, - _bar = rx2.recv() => { fail!() } + _bar = rx2.recv() => { panic!() } ) tx2.send(2); select! ( - _foo = rx1.recv() => { fail!() }, + _foo = rx1.recv() => { panic!() }, bar = rx2.recv() => { assert_eq!(bar, 2) } ) drop(tx1); select! ( foo = rx1.recv_opt() => { assert_eq!(foo, Err(())); }, - _bar = rx2.recv() => { fail!() } + _bar = rx2.recv() => { panic!() } ) drop(tx2); select! ( @@ -379,10 +379,10 @@ mod test { let (tx5, rx5) = channel::<int>(); tx5.send(4); select! ( - _foo = rx1.recv() => { fail!("1") }, - _foo = rx2.recv() => { fail!("2") }, - _foo = rx3.recv() => { fail!("3") }, - _foo = rx4.recv() => { fail!("4") }, + _foo = rx1.recv() => { panic!("1") }, + _foo = rx2.recv() => { panic!("2") }, + _foo = rx3.recv() => { panic!("3") }, + _foo = rx4.recv() => { panic!("4") }, foo = rx5.recv() => { assert_eq!(foo, 4); } ) }) @@ -393,7 +393,7 @@ mod test { drop(tx2); select! ( - _a1 = rx1.recv_opt() => { fail!() }, + _a1 = rx1.recv_opt() => { panic!() }, a2 = rx2.recv_opt() => { assert_eq!(a2, Err(())); } ) }) @@ -412,12 +412,12 @@ mod test { select! ( a = rx1.recv() => { assert_eq!(a, 1); }, - _b = rx2.recv() => { fail!() } + _b = rx2.recv() => { panic!() } ) tx3.send(1); select! ( a = rx1.recv_opt() => { assert_eq!(a, Err(())); }, - _b = rx2.recv() => { fail!() } + _b = rx2.recv() => { panic!() } ) }) @@ -488,7 +488,7 @@ mod test { tx3.send(()); select!( _i1 = rx1.recv() => {}, - _i2 = rx2.recv() => fail!() + _i2 = rx2.recv() => panic!() ) tx3.send(()); }) @@ -509,7 +509,7 @@ mod test { tx3.send(()); select!( _i1 = rx1.recv() => {}, - _i2 = rx2.recv() => fail!() + _i2 = rx2.recv() => panic!() ) tx3.send(()); }) diff --git a/src/libsync/comm/shared.rs b/src/libsync/comm/shared.rs index cfd045d0882..a82efe76289 100644 --- a/src/libsync/comm/shared.rs +++ b/src/libsync/comm/shared.rs @@ -299,7 +299,7 @@ impl<T: Send> Packet<T> { Thread::yield_now(); match self.queue.pop() { mpsc::Data(t) => { data = t; break } - mpsc::Empty => fail!("inconsistent => empty"), + mpsc::Empty => panic!("inconsistent => empty"), mpsc::Inconsistent => {} } } @@ -358,7 +358,7 @@ impl<T: Send> Packet<T> { match self.channels.fetch_sub(1, atomic::SeqCst) { 1 => {} n if n > 1 => return, - n => fail!("bad number of channels left {}", n), + n => panic!("bad number of channels left {}", n), } match self.cnt.swap(DISCONNECTED, atomic::SeqCst) { diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs index 528a15cf6d7..bbb4813f5f9 100644 --- a/src/libsync/comm/sync.rs +++ b/src/libsync/comm/sync.rs @@ -19,7 +19,7 @@ /// which means that every successful send is paired with a successful recv. /// /// This flavor of channels defines a new `send_opt` method for channels which -/// is the method by which a message is sent but the task does not fail if it +/// is the method by which a message is sent but the task does not panic if it /// cannot be delivered. /// /// Another major difference is that send() will *always* return back the data @@ -193,7 +193,7 @@ impl<T: Send> Packet<T> { // success, someone's about to receive our buffered data. BlockedReceiver(task) => { wakeup(task, guard); Ok(()) } - BlockedSender(..) => fail!("lolwut"), + BlockedSender(..) => panic!("lolwut"), } } diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index 09fa8920a07..31889a36dd7 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -467,7 +467,7 @@ mod tests { while left > 0 { match s.steal() { Data((1, 10)) => { left -= 1; } - Data(..) => fail!(), + Data(..) => panic!(), Abort | Empty => {} } } @@ -497,7 +497,7 @@ mod tests { Data(box 20) => { (*unsafe_remaining).fetch_sub(1, SeqCst); } - Data(..) => fail!(), + Data(..) => panic!(), Abort | Empty => {} } } @@ -508,7 +508,7 @@ mod tests { while remaining.load(SeqCst) > 0 { match w.pop() { Some(box 20) => { remaining.fetch_sub(1, SeqCst); } - Some(..) => fail!(), + Some(..) => panic!(), None => {} } } @@ -556,7 +556,7 @@ mod tests { loop { match s.steal() { Data(2) => { HITS.fetch_add(1, SeqCst); } - Data(..) => fail!(), + Data(..) => panic!(), _ if DONE.load(SeqCst) => break, _ => {} } @@ -571,7 +571,7 @@ mod tests { match w.pop() { None => {} Some(2) => { HITS.fetch_add(1, SeqCst); }, - Some(_) => fail!(), + Some(_) => panic!(), } } else { expected += 1; @@ -583,7 +583,7 @@ mod tests { match w.pop() { None => {} Some(2) => { HITS.fetch_add(1, SeqCst); }, - Some(_) => fail!(), + Some(_) => panic!(), } } DONE.store(true, SeqCst); @@ -618,7 +618,7 @@ mod tests { Data((1, 2)) => { (*thread_box).fetch_add(1, SeqCst); } - Data(..) => fail!(), + Data(..) => panic!(), _ if DONE.load(SeqCst) => break, _ => {} } @@ -635,7 +635,7 @@ mod tests { match w.pop() { None => {} Some((1, 2)) => myhit = true, - Some(_) => fail!(), + Some(_) => panic!(), } } else { w.push((1, 2)); diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs index 78a7d128be5..a9b0b7c4803 100644 --- a/src/libsync/lock.rs +++ b/src/libsync/lock.rs @@ -12,11 +12,11 @@ //! //! The wrappers in this module build on the primitives from `sync::raw` to //! provide safe interfaces around using the primitive locks. These primitives -//! implement a technique called "poisoning" where when a task failed with a -//! held lock, all future attempts to use the lock will fail. +//! implement a technique called "poisoning" where when a task panicked with a +//! held lock, all future attempts to use the lock will panic. //! -//! For example, if two tasks are contending on a mutex and one of them fails -//! after grabbing the lock, the second task will immediately fail because the +//! For example, if two tasks are contending on a mutex and one of them panics +//! after grabbing the lock, the second task will immediately panic because the //! lock is now poisoned. use core::prelude::*; @@ -43,7 +43,7 @@ fn failing() -> bool { impl<'a> PoisonOnFail<'a> { fn check(flag: bool, name: &str) { if flag { - fail!("Poisoned {} - another task failed inside!", name); + panic!("Poisoned {} - another task failed inside!", name); } } @@ -99,10 +99,10 @@ impl<'a> Condvar<'a> { /// /// wait() is equivalent to wait_on(0). /// - /// # Failure + /// # Panics /// /// A task which is killed while waiting on a condition variable will wake - /// up, fail, and unlock the associated lock as it unwinds. + /// up, panic, and unlock the associated lock as it unwinds. #[inline] pub fn wait(&self) { self.wait_on(0) } @@ -213,12 +213,12 @@ impl<T: Send> Mutex<T> { /// when dropped. All concurrent tasks attempting to lock the mutex will /// block while the returned value is still alive. /// - /// # Failure + /// # Panics /// - /// Failing while inside the Mutex will unlock the Mutex while unwinding, so + /// Panicking while inside the Mutex will unlock the Mutex while unwinding, so /// that other tasks won't block forever. It will also poison the Mutex: /// any tasks that subsequently try to access it (including those already - /// blocked on the mutex) will also fail immediately. + /// blocked on the mutex) will also panic immediately. #[inline] pub fn lock<'a>(&'a self) -> MutexGuard<'a, T> { let guard = self.lock.lock(); @@ -317,11 +317,11 @@ impl<T: Send + Sync> RWLock<T> { /// Access the underlying data mutably. Locks the rwlock in write mode; /// other readers and writers will block. /// - /// # Failure + /// # Panics /// - /// Failing while inside the lock will unlock the lock while unwinding, so + /// Panicking while inside the lock will unlock the lock while unwinding, so /// that other tasks won't block forever. As Mutex.lock, it will also poison - /// the lock, so subsequent readers and writers will both also fail. + /// the lock, so subsequent readers and writers will both also panic. #[inline] pub fn write<'a>(&'a self) -> RWLockWriteGuard<'a, T> { let guard = self.lock.write(); @@ -496,7 +496,7 @@ mod tests { let lock = arc2.lock(); lock.cond.signal(); // Parent should fail when it wakes up. - fail!(); + panic!(); }); let lock = arc.lock(); @@ -546,7 +546,7 @@ mod tests { } } let _u = Unwinder { i: arc2 }; - fail!(); + panic!(); }); let lock = arc.lock(); assert_eq!(*lock, 2); @@ -661,7 +661,7 @@ mod tests { } } let _u = Unwinder { i: arc2 }; - fail!(); + panic!(); }); let lock = arc.read(); assert_eq!(*lock, 2); diff --git a/src/libsync/mpsc_queue.rs b/src/libsync/mpsc_queue.rs index ac2acf3d7d4..69dc2fe8e60 100644 --- a/src/libsync/mpsc_queue.rs +++ b/src/libsync/mpsc_queue.rs @@ -177,7 +177,7 @@ mod tests { let q = Queue::new(); match q.pop() { Empty => {} - Inconsistent | Data(..) => fail!() + Inconsistent | Data(..) => panic!() } let (tx, rx) = channel(); let q = Arc::new(q); diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index 81ae8dbb98f..4fd62ac3a1d 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -216,10 +216,10 @@ pub struct Condvar<'a> { impl<'a> Condvar<'a> { /// Atomically drop the associated lock, and block until a signal is sent. /// - /// # Failure + /// # Panics /// /// A task which is killed while waiting on a condition variable will wake - /// up, fail, and unlock the associated lock as it unwinds. + /// up, panic, and unlock the associated lock as it unwinds. pub fn wait(&self) { self.wait_on(0) } /// As wait(), but can specify which of multiple condition variables to @@ -228,7 +228,7 @@ impl<'a> Condvar<'a> { /// /// The associated lock must have been initialised with an appropriate /// number of condvars. The condvar_id must be between 0 and num_condvars-1 - /// or else this call will fail. + /// or else this call will panic. /// /// wait() is equivalent to wait_on(0). pub fn wait_on(&self, condvar_id: uint) { @@ -324,7 +324,7 @@ impl<'a> Condvar<'a> { } } -// Checks whether a condvar ID was out of bounds, and fails if so, or does +// Checks whether a condvar ID was out of bounds, and panics if so, or does // something else next on success. #[inline] fn check_cvar_bounds<U>( @@ -335,9 +335,9 @@ fn check_cvar_bounds<U>( -> U { match out_of_bounds { Some(0) => - fail!("{} with illegal ID {} - this lock has no condvars!", act, id), + panic!("{} with illegal ID {} - this lock has no condvars!", act, id), Some(length) => - fail!("{} with illegal ID {} - ID must be less than {}", act, id, length), + panic!("{} with illegal ID {} - ID must be less than {}", act, id, length), None => blk() } } @@ -367,9 +367,9 @@ pub struct SemaphoreGuard<'a> { impl Semaphore { /// Create a new semaphore with the specified count. /// - /// # Failure + /// # Panics /// - /// This function will fail if `count` is negative. + /// This function will panic if `count` is negative. pub fn new(count: int) -> Semaphore { Semaphore { sem: Sem::new(count, ()) } } @@ -396,8 +396,9 @@ impl Semaphore { /// A blocking, bounded-waiting, mutual exclusion lock with an associated /// FIFO condition variable. /// -/// # Failure -/// A task which fails while holding a mutex will unlock the mutex as it +/// # Panics +/// +/// A task which panicks while holding a mutex will unlock the mutex as it /// unwinds. pub struct Mutex { sem: Sem<Vec<WaitQueue>>, @@ -421,7 +422,7 @@ impl Mutex { /// Create a new mutex, with a specified number of associated condvars. This /// will allow calling wait_on/signal_on/broadcast_on with condvar IDs /// between 0 and num_condvars-1. (If num_condvars is 0, lock_cond will be - /// allowed but any operations on the condvar will fail.) + /// allowed but any operations on the condvar will panic.) pub fn new_with_condvars(num_condvars: uint) -> Mutex { Mutex { sem: Sem::new_and_signal(1, num_condvars) } } @@ -443,9 +444,9 @@ impl Mutex { /// A blocking, no-starvation, reader-writer lock with an associated condvar. /// -/// # Failure +/// # Panics /// -/// A task which fails while holding an rwlock will unlock the rwlock as it +/// A task which panics while holding an rwlock will unlock the rwlock as it /// unwinds. pub struct RWLock { order_lock: Semaphore, @@ -835,13 +836,13 @@ mod tests { fn test_mutex_killed_simple() { use std::any::Any; - // Mutex must get automatically unlocked if failed/killed within. + // Mutex must get automatically unlocked if panicked/killed within. let m = Arc::new(Mutex::new()); let m2 = m.clone(); let result: result::Result<(), Box<Any + Send>> = task::try(proc() { let _lock = m2.lock(); - fail!(); + panic!(); }); assert!(result.is_err()); // child task must have finished by the time try returns @@ -1075,13 +1076,13 @@ mod tests { fn rwlock_kill_helper(mode1: RWLockMode, mode2: RWLockMode) { use std::any::Any; - // Mutex must get automatically unlocked if failed/killed within. + // Mutex must get automatically unlocked if panicked/killed within. let x = Arc::new(RWLock::new()); let x2 = x.clone(); let result: result::Result<(), Box<Any + Send>> = task::try(proc() { lock_rwlock_in_mode(&x2, mode1, || { - fail!(); + panic!(); }) }); assert!(result.is_err()); diff --git a/src/libsync/spsc_queue.rs b/src/libsync/spsc_queue.rs index 9cd64d46bad..ef0ceb14145 100644 --- a/src/libsync/spsc_queue.rs +++ b/src/libsync/spsc_queue.rs @@ -369,7 +369,7 @@ mod test { loop { match consumer.pop() { Some(1i) => break, - Some(_) => fail!(), + Some(_) => panic!(), None => {} } } |
