Closed
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).