-
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
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
34eed06
to
583b10d
Compare
This comment has been minimized.
This comment has been minimized.
These were accidentally removed in rust-lang#94247 because the representation was changed from &mut [T] to *mut T, which has !Send + !Sync.
583b10d
to
22dfbdd
Compare
@bors r+ |
@bors p=1 to push this through before we branch beta |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a reliable test? Don't we allow false where
clauses that can never be satisfied (or might allow such things in the future)?
IMO the test should also call this function, to ensure its where clauses can actually be satisfied. An unused function with precondition False
proves nothing.
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.
Yeah, we need an instantiation of it (not necessarily a call), à là:
let _ = assert_send_and_sync;
I guess a #[deny(trivial_bounds)]
could do the job as well, since even with feature(trivial_bounds)
at least that lint gets fired
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2114,6 +2120,12 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for ChunksExactMut<'a, T> { | |||
const MAY_HAVE_SIDE_EFFECT: bool = false; | |||
} | |||
|
|||
#[stable(feature = "chunks_exact", since = "1.31.0")] | |||
unsafe impl<T> Send for ChunksExactMut<'_, T> where T: Send {} |
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:
unsafe impl<T> Send for ChunksExactMut<'_, T> where T: Send {} | |
unsafe impl<'r, T> Send for ChunksExactMut<'r, T> where &'r mut [T]: Send {} |
(this makes it "easier" to understand the causality relation, imho)
- and so on for the others
☀️ Test successful - checks-actions |
Finished benchmarking commit (04f72f9): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesThis benchmark run did not return any relevant results for this metric. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
…-ou-se Fix test: chunks_mut_are_send_and_sync Follow-up to rust-lang#100023 to make the test actually effective
Fix test: chunks_mut_are_send_and_sync Follow-up to rust-lang/rust#100023 to make the test actually effective
Fixes #100014
These were accidentally removed in #94247 because the representation was changed from
&mut [T]
to*mut T
, which has!Send + !Sync
.