Skip to main content

branches_share_mutable_state

Function branches_share_mutable_state 

Source
pub fn branches_share_mutable_state(tasks: &[Stmt<'_>]) -> bool
Expand description

Do any two branches of a Parallel/Concurrent block share non-channel mutable state — a variable or collection one writes and another reads or writes? This is the data-race predicate the Send/escape analysis rejects on.

It deliberately differs from branches_independent on one axis: a shared Pipe is not a violation here. A channel is safe under concurrent access (it is the sanctioned message-passing mechanism), so branches that only communicate through a pipe are race-free — they are merely nondeterminate, which is the determinacy classifier’s concern, not safety’s.