Parallel Borrow Analysis (174)
Objective: make borrowck compatible with parallelism.
Contracts
Sendequivalent:- a value moved to a thread context must be transferable without a concurrent mutable alias.
Syncequivalent:- any cross-threaded mutable shared access must be explicitly synchronized.
- Shared mutation:
- concurrent shared resource mutation without lock/atomic is rejected.
- Thread ownership:
- a mutable reference must not escape from its logical owner to a concurrent thread.
Foundation diagnostics
BORROWCK_E_PARALLEL_SEND_VIOLATIONBORROWCK_E_PARALLEL_SYNC_VIOLATIONBORROWCK_E_SHARED_MUTATION_ACROSS_THREADSBORROWCK_E_THREAD_OWNERSHIP_VIOLATIONBORROWCK_E_CONCURRENCY_RACE_RISK
Current implementation
- Heuristic analysis of thread/send/sync/race patterns from HIR statements.
- Merger of diagnostics with the existing borrowck (ownership/moves/loans/lifetimes).