Add unsafe Send and Sync impls to VecDeque's Drain<T>

This commit is contained in:
Michael Layzell 2015-09-24 18:19:23 -04:00
parent 45be6fc4d7
commit 493355d8e9
2 changed files with 5 additions and 1 deletions

View File

@ -1800,6 +1800,9 @@ pub struct Drain<'a, T: 'a> {
deque: *mut VecDeque<T>, deque: *mut VecDeque<T>,
} }
unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
unsafe impl<'a, T: Send> Send for Drain<'a, T> {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> Drop for Drain<'a, T> { impl<'a, T: 'a> Drop for Drain<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {

View File

@ -93,7 +93,8 @@ fn from_usize(v: usize) -> Foo {
} }
all_sync_send!(EnumSet::<Foo>::new(), iter); all_sync_send!(EnumSet::<Foo>::new(), iter);
all_sync_send!(VecDeque::<usize>::new(), iter, iter_mut, drain, into_iter); all_sync_send!(VecDeque::<usize>::new(), iter, iter_mut, into_iter);
is_sync_send!(VecDeque::<usize>::new(), drain(..));
all_sync_send!(Vec::<usize>::new(), into_iter); all_sync_send!(Vec::<usize>::new(), into_iter);
is_sync_send!(Vec::<usize>::new(), drain(..)); is_sync_send!(Vec::<usize>::new(), drain(..));