File tree 1 file changed +23
-12
lines changed
src/tools/rust-analyzer/crates/rust-analyzer/src
1 file changed +23
-12
lines changed Original file line number Diff line number Diff line change 4
4
use std:: {
5
5
fmt,
6
6
ops:: Div as _,
7
+ panic:: AssertUnwindSafe ,
7
8
time:: { Duration , Instant } ,
8
9
} ;
9
10
@@ -552,23 +553,33 @@ impl GlobalState {
552
553
let fetch_semantic =
553
554
self . vfs_done && self . fetch_workspaces_queue . last_op_result ( ) . is_some ( ) ;
554
555
move |sender| {
555
- let diags = fetch_native_diagnostics (
556
- & snapshot,
557
- subscriptions. clone ( ) ,
558
- slice. clone ( ) ,
559
- NativeDiagnosticsFetchKind :: Syntax ,
560
- ) ;
556
+ // We aren't observing the semantics token cache here
557
+ let snapshot = AssertUnwindSafe ( & snapshot) ;
558
+ let Ok ( diags) = std:: panic:: catch_unwind ( || {
559
+ fetch_native_diagnostics (
560
+ & snapshot,
561
+ subscriptions. clone ( ) ,
562
+ slice. clone ( ) ,
563
+ NativeDiagnosticsFetchKind :: Syntax ,
564
+ )
565
+ } ) else {
566
+ return ;
567
+ } ;
561
568
sender
562
569
. send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Syntax ( generation, diags) ) )
563
570
. unwrap ( ) ;
564
571
565
572
if fetch_semantic {
566
- let diags = fetch_native_diagnostics (
567
- & snapshot,
568
- subscriptions,
569
- slice,
570
- NativeDiagnosticsFetchKind :: Semantic ,
571
- ) ;
573
+ let Ok ( diags) = std:: panic:: catch_unwind ( || {
574
+ fetch_native_diagnostics (
575
+ & snapshot,
576
+ subscriptions. clone ( ) ,
577
+ slice. clone ( ) ,
578
+ NativeDiagnosticsFetchKind :: Semantic ,
579
+ )
580
+ } ) else {
581
+ return ;
582
+ } ;
572
583
sender
573
584
. send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Semantic (
574
585
generation, diags,
You can’t perform that action at this time.
0 commit comments