Repository navigation
slice::Chunks[Exact]Mut are no longer Send + Sync after #94247 #100014
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
I tried this code (Playground):
struct AssertChunksExactMutPropagatesSend
where
std::slice::ChunksExactMut<'static, std::cell::Cell<u32>>: Send;
struct AssertChunksExactMutPropagatesSync
where
std::slice::ChunksExactMut<'static, std::sync::MutexGuard<'static, u32>>: Sync;I expected to see this happen: Successful compilation (as it does in 1.62.1)
Instead, this happened:
error[E0277]: `*mut [Cell<u32>]` cannot be sent between threads safely
--> src/lib.rs:3:5
|
3 | std::slice::ChunksExactMut<'static, std::cell::Cell<u32>>: Send;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut [Cell<u32>]` cannot be sent between threads safely
|
= help: within `ChunksExactMut<'static, Cell<u32>>`, the trait `Send` is not implemented for `*mut [Cell<u32>]`
= note: required because it appears within the type `ChunksExactMut<'static, Cell<u32>>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
error[E0277]: `*mut [MutexGuard<'static, u32>]` cannot be shared between threads safely
--> src/lib.rs:6:5
|
6 | std::slice::ChunksExactMut<'static, std::sync::MutexGuard<'static, u32>>: Sync;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut [MutexGuard<'static, u32>]` cannot be shared between threads safely
|
= help: within `ChunksExactMut<'static, MutexGuard<'static, u32>>`, the trait `Sync` is not implemented for `*mut [MutexGuard<'static, u32>]`
= note: required because it appears within the type `ChunksExactMut<'static, MutexGuard<'static, u32>>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
For more information about this error, try `rustc --explain E0277`.
Meta
rustc --version --verbose:
rustc 1.64.0-nightly (f9cba6374 2022-07-31)
binary: rustc
commit-hash: f9cba63746d0fff816250b2ba7b706b5d4dcf000
commit-date: 2022-07-31
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
The problem doesn't occur with nightly-2022-07-27 (pre-#94247).
Reacted by Ben Kimock and the8472
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Activity
lcnr commentedon Aug 1, 2022
saethlin commentedon Aug 1, 2022
@rustbot claim
Auto merge of rust-lang#100023 - saethlin:send-sync-chunksmut, r=m-ou-se
apiraino commentedon Aug 3, 2022
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-high
Auto merge of #100023 - saethlin:send-sync-chunksmut, r=m-ou-se
Auto merge of #100023 - saethlin:send-sync-chunksmut, r=m-ou-se
Auto merge of #100023 - saethlin:send-sync-chunksmut, r=m-ou-se