rollup merge of #20560: aturon/stab-2-iter-ops-slice
Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
This commit is contained in:
@@ -188,6 +188,7 @@ impl Condvar {
|
||||
pub fn notify_all(&self) { unsafe { self.inner.inner.notify_all() } }
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl Drop for Condvar {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.inner.inner.destroy() }
|
||||
|
||||
@@ -675,6 +675,7 @@ impl<T: Send> Clone for Sender<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<T: Send> Drop for Sender<T> {
|
||||
fn drop(&mut self) {
|
||||
match *unsafe { self.inner_mut() } {
|
||||
@@ -768,6 +769,7 @@ impl<T: Send> Clone for SyncSender<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<T: Send> Drop for SyncSender<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { (*self.inner.get()).drop_chan(); }
|
||||
@@ -1006,12 +1008,15 @@ impl<T: Send> select::Packet for Receiver<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable]
|
||||
impl<'a, T: Send> Iterator<T> for Messages<'a, T> {
|
||||
fn next(&mut self) -> Option<T> { self.rx.recv_opt().ok() }
|
||||
#[stable]
|
||||
impl<'a, T: Send> Iterator for Iter<'a, T> {
|
||||
type Item = T;
|
||||
|
||||
fn next(&mut self) -> Option<T> { self.rx.recv().ok() }
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<T: Send> Drop for Receiver<T> {
|
||||
fn drop(&mut self) {
|
||||
match *unsafe { self.inner_mut() } {
|
||||
|
||||
@@ -138,6 +138,7 @@ impl<T: Send> Queue<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<T: Send> Drop for Queue<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
||||
@@ -228,6 +228,7 @@ impl<T: Send> Mutex<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<T: Send> Drop for Mutex<T> {
|
||||
fn drop(&mut self) {
|
||||
// This is actually safe b/c we know that there is no further usage of
|
||||
@@ -291,6 +292,7 @@ impl<'mutex, T> MutexGuard<'mutex, T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl<'mutex, T> Deref for MutexGuard<'mutex, T> {
|
||||
type Target = T;
|
||||
|
||||
@@ -298,6 +300,7 @@ impl<'mutex, T> Deref for MutexGuard<'mutex, T> {
|
||||
unsafe { &*self.__data.get() }
|
||||
}
|
||||
}
|
||||
#[stable]
|
||||
impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> {
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut T {
|
||||
unsafe { &mut *self.__data.get() }
|
||||
@@ -305,6 +308,7 @@ impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<'a, T> Drop for MutexGuard<'a, T> {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
|
||||
@@ -228,6 +228,7 @@ impl<T: Send + Sync> RwLock<T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<T> Drop for RwLock<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.inner.lock.destroy() }
|
||||
@@ -327,16 +328,19 @@ impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &T { unsafe { &*self.__data.get() } }
|
||||
}
|
||||
#[stable]
|
||||
impl<'rwlock, T> Deref for RwLockWriteGuard<'rwlock, T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &T { unsafe { &*self.__data.get() } }
|
||||
}
|
||||
#[stable]
|
||||
impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> {
|
||||
fn deref_mut(&mut self) -> &mut T {
|
||||
unsafe { &mut *self.__data.get() }
|
||||
@@ -344,6 +348,7 @@ impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<'a, T> Drop for RwLockReadGuard<'a, T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.__lock.lock.read_unlock(); }
|
||||
@@ -351,6 +356,7 @@ impl<'a, T> Drop for RwLockReadGuard<'a, T> {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
|
||||
fn drop(&mut self) {
|
||||
self.__lock.poison.done(&self.__poison);
|
||||
|
||||
@@ -99,6 +99,7 @@ impl Semaphore {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
#[stable]
|
||||
impl<'a> Drop for SemaphoreGuard<'a> {
|
||||
fn drop(&mut self) {
|
||||
self.sem.release();
|
||||
|
||||
Reference in New Issue
Block a user