File tree 4 files changed +11
-6
lines changed
src/tools/rust-analyzer/crates
4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ fn expand_id(
175
175
} ) ;
176
176
let res = match thread {
177
177
Ok ( handle) => handle. join ( ) ,
178
- Err ( e) => std :: panic :: resume_unwind ( Box :: new ( e ) ) ,
178
+ Err ( e) => return Err ( e . to_string ( ) ) ,
179
179
} ;
180
180
181
181
match res {
@@ -223,7 +223,7 @@ fn expand_ra_span(
223
223
} ) ;
224
224
let res = match thread {
225
225
Ok ( handle) => handle. join ( ) ,
226
- Err ( e) => std :: panic :: resume_unwind ( Box :: new ( e ) ) ,
226
+ Err ( e) => return Err ( e . to_string ( ) ) ,
227
227
} ;
228
228
229
229
match res {
Original file line number Diff line number Diff line change @@ -610,11 +610,9 @@ where
610
610
#[ non_exhaustive]
611
611
pub enum Cancelled {
612
612
/// The query was operating on revision R, but there is a pending write to move to revision R+1.
613
- #[ non_exhaustive]
614
613
PendingWrite ,
615
614
616
615
/// The query was blocked on another thread, and that thread panicked.
617
- #[ non_exhaustive]
618
616
PropagatedPanic ,
619
617
}
620
618
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use std::{
5
5
} ;
6
6
7
7
use ide:: Cancelled ;
8
+ use ide_db:: base_db:: ra_salsa:: Cycle ;
8
9
use lsp_server:: { ExtractError , Response , ResponseError } ;
9
10
use serde:: { de:: DeserializeOwned , Serialize } ;
10
11
use stdx:: thread:: ThreadIntent ;
@@ -328,7 +329,13 @@ where
328
329
if let Some ( panic_message) = panic_message {
329
330
message. push_str ( ": " ) ;
330
331
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
+ }
332
339
333
340
Ok ( lsp_server:: Response :: new_err (
334
341
id,
Original file line number Diff line number Diff line change @@ -1085,7 +1085,7 @@ fn resolve_proc_macro() {
1085
1085
let sysroot = project_model:: Sysroot :: discover (
1086
1086
& AbsPathBuf :: assert_utf8 ( std:: env:: current_dir ( ) . unwrap ( ) ) ,
1087
1087
& Default :: default ( ) ,
1088
- project_model:: SysrootQueryMetadata :: CargoMetadata ,
1088
+ & project_model:: SysrootQueryMetadata :: default ( ) ,
1089
1089
) ;
1090
1090
1091
1091
let proc_macro_server_path = sysroot. discover_proc_macro_srv ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments