ruff
ruff copied to clipboard
[red-knot] Prevent salsa cancellation from aborting the program
Summary
This PR wraps the public-visible Program methods to use Cancelled::catch to prevent that any salsa cancellation tears down its thread.
I honestly don't think this change is safe in Rust terms, but it is what rust-analyzer and other Salsa based compilers to (most implement the UnwindSafe marker trait but I prefer not to do this).
I've opened a Zulip thread to get more guidance but, for now, I think this is sufficiently "safe" (I hate this).
Test Plan
I ran red_knot with RED_KNOT_SLOW_LINT=1 which adds an artificial 10s pause to the lint query. The query was correctly cancelled when I made changes to a file in the workspace directory without tearing down the entire rayon thread pool.
ruff-ecosystem results
Linter (stable)
✅ ecosystem check detected no linter changes.
Linter (preview)
✅ ecosystem check detected no linter changes.