This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-12
lines changed
src/tools/rust-analyzer/crates/rust-analyzer/src Expand file tree Collapse file tree 1 file changed +23
-12
lines changed Original file line number Diff line number Diff line change 44use std:: {
55 fmt,
66 ops:: Div as _,
7+ panic:: AssertUnwindSafe ,
78 time:: { Duration , Instant } ,
89} ;
910
@@ -552,23 +553,33 @@ impl GlobalState {
552553 let fetch_semantic =
553554 self . vfs_done && self . fetch_workspaces_queue . last_op_result ( ) . is_some ( ) ;
554555 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+ } ;
561568 sender
562569 . send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Syntax ( generation, diags) ) )
563570 . unwrap ( ) ;
564571
565572 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+ } ;
572583 sender
573584 . send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Semantic (
574585 generation, diags,
You can’t perform that action at this time.
0 commit comments