Skip to content

Commit b53424d

Browse files
committed
Gracefully handle panics
1 parent d9090a8 commit b53424d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/ty_server/src/server/api/requests/workspace_diagnostic.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,12 @@ impl ProgressReporter for WorkspaceDiagnosticsProgressReporter<'_> {
257257
self.report_progress();
258258
}
259259

260-
let mut response = self.response.lock().unwrap();
260+
// Another thread might have panicked at this point because of a salsa cancellation which
261+
// poisoned the result. If the response is poisoned, just don't report and wait for our thread
262+
// to unwind with a salsa cancellation next.
263+
let Ok(mut response) = self.response.lock() else {
264+
return;
265+
};
261266

262267
// Don't report empty diagnostics. We clear previous diagnostics in `into_response`
263268
// which also handles the case where a file no longer has diagnostics because

0 commit comments

Comments
 (0)