File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
src/tools/rust-analyzer/crates
rust-analyzer/src/handlers Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ fn expand_id(
175175 } ) ;
176176 let res = match thread {
177177 Ok ( handle) => handle. join ( ) ,
178- Err ( e) => std :: panic :: resume_unwind ( Box :: new ( e ) ) ,
178+ Err ( e) => return Err ( e . to_string ( ) ) ,
179179 } ;
180180
181181 match res {
@@ -223,7 +223,7 @@ fn expand_ra_span(
223223 } ) ;
224224 let res = match thread {
225225 Ok ( handle) => handle. join ( ) ,
226- Err ( e) => std :: panic :: resume_unwind ( Box :: new ( e ) ) ,
226+ Err ( e) => return Err ( e . to_string ( ) ) ,
227227 } ;
228228
229229 match res {
Original file line number Diff line number Diff line change @@ -610,11 +610,9 @@ where
610610#[ non_exhaustive]
611611pub enum Cancelled {
612612 /// The query was operating on revision R, but there is a pending write to move to revision R+1.
613- #[ non_exhaustive]
614613 PendingWrite ,
615614
616615 /// The query was blocked on another thread, and that thread panicked.
617- #[ non_exhaustive]
618616 PropagatedPanic ,
619617}
620618
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use std::{
55} ;
66
77use ide:: Cancelled ;
8+ use ide_db:: base_db:: ra_salsa:: Cycle ;
89use lsp_server:: { ExtractError , Response , ResponseError } ;
910use serde:: { de:: DeserializeOwned , Serialize } ;
1011use stdx:: thread:: ThreadIntent ;
@@ -328,7 +329,13 @@ where
328329 if let Some ( panic_message) = panic_message {
329330 message. push_str ( ": " ) ;
330331 message. push_str ( panic_message)
331- } ;
332+ } else if let Some ( cycle) = panic. downcast_ref :: < Cycle > ( ) {
333+ tracing:: error!( "Cycle propagated out of salsa! This is a bug: {cycle:?}" ) ;
334+ return Err ( Cancelled :: PropagatedPanic ) ;
335+ } else if let Ok ( cancelled) = panic. downcast :: < Cancelled > ( ) {
336+ tracing:: error!( "Cancellation propagated out of salsa! This is a bug" ) ;
337+ return Err ( * cancelled) ;
338+ }
332339
333340 Ok ( lsp_server:: Response :: new_err (
334341 id,
You can’t perform that action at this time.
0 commit comments