Skip to content

Commit cd413d0

Browse files
authored
Merge pull request #19888 from Veykril/push-wylsryzpnnop
fix: Recognize salsa cycles in `thread_result_to_response`
2 parents ed608f5 + 07e4d58 commit cd413d0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/rust-analyzer/src/handlers/dispatch.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66

77
use ide_db::base_db::{
88
DbPanicContext,
9-
salsa::{self, Cancelled},
9+
salsa::{self, Cancelled, UnexpectedCycle},
1010
};
1111
use lsp_server::{ExtractError, Response, ResponseError};
1212
use serde::{Serialize, de::DeserializeOwned};
@@ -349,11 +349,14 @@ where
349349
let mut message = "request handler panicked".to_owned();
350350
if let Some(panic_message) = panic_message {
351351
message.push_str(": ");
352-
message.push_str(panic_message)
352+
message.push_str(panic_message);
353+
} else if let Some(cycle) = panic.downcast_ref::<UnexpectedCycle>() {
354+
tracing::error!("{cycle}");
355+
message.push_str(": unexpected cycle");
353356
} else if let Ok(cancelled) = panic.downcast::<Cancelled>() {
354357
tracing::error!("Cancellation propagated out of salsa! This is a bug");
355358
return Err(HandlerCancelledError::Inner(*cancelled));
356-
}
359+
};
357360

358361
Ok(lsp_server::Response::new_err(
359362
id,

0 commit comments

Comments
 (0)