-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add back Send and Sync impls on ChunksMut iterators #100023
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1191,6 +1191,27 @@ fn test_rchunks_exact_mut_zip() { | |
assert_eq!(v1, [0, 16, 17, 22, 23]); | ||
} | ||
|
||
#[test] | ||
fn chunks_mut_are_send_and_sync() { | ||
use std::cell::Cell; | ||
use std::slice::{ChunksExactMut, ChunksMut, RChunksExactMut, RChunksMut}; | ||
use std::sync::MutexGuard; | ||
|
||
#[allow(unused)] | ||
fn assert_send_and_sync() | ||
where | ||
ChunksMut<'static, Cell<i32>>: Send, | ||
ChunksMut<'static, MutexGuard<'static, u32>>: Sync, | ||
ChunksExactMut<'static, Cell<i32>>: Send, | ||
ChunksExactMut<'static, MutexGuard<'static, u32>>: Sync, | ||
RChunksMut<'static, Cell<i32>>: Send, | ||
RChunksMut<'static, MutexGuard<'static, u32>>: Sync, | ||
RChunksExactMut<'static, Cell<i32>>: Send, | ||
RChunksExactMut<'static, MutexGuard<'static, u32>>: Sync, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that a reliable test? Don't we allow false IMO the test should also call this function, to ensure its where clauses can actually be satisfied. An unused function with precondition There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we need an instantiation of it (not necessarily a call), à là: let _ = assert_send_and_sync; I guess a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may have time to address this in a follow-up tomorrow. I didn't want to delay this PR, and I don't have any spare time for this in the near future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{ | ||
} | ||
} | ||
|
||
#[test] | ||
fn test_windows_count() { | ||
let v: &[i32] = &[0, 1, 2, 3, 4, 5]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debatable nit, but pointing it out just for consideration:
(this makes it "easier" to understand the causality relation, imho)