Loose Send/Sync bounds for WorkerLocal used in rayon fork for parallel-compiler #81425
Labels
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-compiler-parallel
Working group: Parallelizing the compiler
The
WorkerLocal
type used in theparallel-compiler
cfg:rust/compiler/rustc_data_structures/src/sync.rs
Line 387 in 388ef34
which comes from the Rust fork of rayon, rustc-rayon, implements
Send
andSync
unconditionally for all typesT
:https://github.com/rust-lang/rustc-rayon/blob/ae7bbbd2756a324c493aef5f5d52473101b2f491/rayon-core/src/worker_local.rs#L10-L19
While all the current inhabitants of the type
T
in rustc are sound, as in they are safe to send across threads, this allows for the potential of data races if someone accidentally uses a non-Send
type such asRc
in aWorkerLocal
.As per @cuviper in #t-compiler/wg-parallel-rustc on Zulip, this should be bound by
T: Send
. https://rust-lang.zulipchat.com/#narrow/stream/187679-t-compiler.2Fwg-parallel-rustc/topic/WorkerLocal.20type.20in.20rustc.20rayon.20fork/near/224118580The text was updated successfully, but these errors were encountered: