mirror of
				https://github.com/astral-sh/ruff.git
				synced 2025-10-31 20:08:19 +00:00 
			
		
		
		
	[ty] Gracefully handle salsa cancellations and panics in background request handlers (#18254)
This commit is contained in:
		
							parent
							
								
									d51f6940fe
								
							
						
					
					
						commit
						d8216fa328
					
				
					 9 changed files with 146 additions and 95 deletions
				
			
		|  | @ -1,10 +1,5 @@ | |||
| //! Scheduling, I/O, and API endpoints.
 | ||||
| 
 | ||||
| use std::num::NonZeroUsize; | ||||
| // The new PanicInfoHook name requires MSRV >= 1.82
 | ||||
| #[expect(deprecated)] | ||||
| use std::panic::PanicInfo; | ||||
| 
 | ||||
| use lsp_server::Message; | ||||
| use lsp_types::{ | ||||
|     ClientCapabilities, DiagnosticOptions, DiagnosticServerCapabilities, | ||||
|  | @ -13,6 +8,8 @@ use lsp_types::{ | |||
|     TextDocumentSyncCapability, TextDocumentSyncKind, TextDocumentSyncOptions, | ||||
|     TypeDefinitionProviderCapability, Url, | ||||
| }; | ||||
| use std::num::NonZeroUsize; | ||||
| use std::panic::PanicHookInfo; | ||||
| 
 | ||||
| use self::connection::{Connection, ConnectionInitializer}; | ||||
| use self::schedule::event_loop_thread; | ||||
|  | @ -125,9 +122,7 @@ impl Server { | |||
|     } | ||||
| 
 | ||||
|     pub(crate) fn run(self) -> crate::Result<()> { | ||||
|         // The new PanicInfoHook name requires MSRV >= 1.82
 | ||||
|         #[expect(deprecated)] | ||||
|         type PanicHook = Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>; | ||||
|         type PanicHook = Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send>; | ||||
|         struct RestorePanicHook { | ||||
|             hook: Option<PanicHook>, | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Micha Reiser
						Micha Reiser