From cb3d04c8182ca2220391e816d4ea91c5ba3adbec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 26 Aug 2021 22:11:54 +0300 Subject: [PATCH] minor: nicer way to defeat disjoint closure captures Thanks https://internals.rust-lang.org/t/feature-idea-edition-dependent-names-replacing-standard-library-items/15198/27?u=matklad! --- crates/rust-analyzer/src/dispatch.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs index 031c76c772..07ab46647f 100644 --- a/crates/rust-analyzer/src/dispatch.rs +++ b/crates/rust-analyzer/src/dispatch.rs @@ -33,8 +33,10 @@ impl<'a> RequestDispatcher<'a> { let global_state = panic::AssertUnwindSafe(&mut *self.global_state); let result = panic::catch_unwind(move || { - let _ = &global_state; - let panic::AssertUnwindSafe(global_state) = global_state; + // Make sure that the whole AssertUnwindSafe is moved into the + // closure, and not just its field. + let panic::AssertUnwindSafe(global_state) = { global_state }; + let _pctx = stdx::panic_context::enter(format!( "\nversion: {}\nrequest: {} {:#?}", env!("REV"),