Skip to content

Make it impossible for background threads to mutate Salsa inputs#1314

Open
lionel- wants to merge 1 commit into
mainfrom
oak/analysis-db
Open

Make it impossible for background threads to mutate Salsa inputs#1314
lionel- wants to merge 1 commit into
mainfrom
oak/analysis-db

Conversation

@lionel-

@lionel- lionel- commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Part of #1212

This approach is taken from Rust-Analyzer where a snapshot is guaranteed to never write to the DB. Having this type-enforced safety is nice because writing to the DB from outside the main loop could deadlock.

  • New WorldSnapshot type that's the read-only counterpart to WorldState. It holds a clone of the Salsa data wrapped in Analysis, as well as clones of other world state fields.

  • New Analysis type that holds the OakDatabase in a private field, and lends it only as a shared reference. This is what prevents writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant