diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ee83f782f4..9c0f3093e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ env: CARGO_NET_RETRY: 10 CI: 1 RUST_BACKTRACE: short - RUSTFLAGS: "-D warnings -W unreachable-pub" + RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility" RUSTUP_MAX_RETRIES: 10 jobs: diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 4c09b2ab19..4ec3e10f49 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs @@ -547,10 +547,10 @@ impl InFile { self, db: &dyn db::AstDatabase, ) -> impl Iterator> + '_ { - self.value - .parent() - .into_iter() - .flat_map(move |parent| InFile::new(self.file_id, parent).ancestors_with_macros(db)) + self.value.parent().into_iter().flat_map({ + let file_id = self.file_id; + move |parent| InFile::new(file_id, parent).ancestors_with_macros(db) + }) } } diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs index 5991e72b5e..609459b7ed 100644 --- a/crates/rust-analyzer/src/dispatch.rs +++ b/crates/rust-analyzer/src/dispatch.rs @@ -30,16 +30,18 @@ impl<'a> RequestDispatcher<'a> { Some(it) => it, None => return Ok(self), }; - let world = panic::AssertUnwindSafe(&mut *self.global_state); + let global_state = panic::AssertUnwindSafe(&mut *self.global_state); let response = panic::catch_unwind(move || { + let _ = &global_state; + let panic::AssertUnwindSafe(global_state) = global_state; let _pctx = stdx::panic_context::enter(format!( "\nversion: {}\nrequest: {} {:#?}", env!("REV"), R::METHOD, params )); - let result = f(world.0, params); + let result = f(global_state, params); result_to_response::(id, result) }) .map_err(|_err| format!("sync task {:?} panicked", R::METHOD))?; diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 1330370472..42eff1875e 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -420,12 +420,12 @@ impl GlobalState { self.prime_caches_queue.request_op(); if self.prime_caches_queue.should_start_op() { self.task_pool.handle.spawn_with_sender({ - let snap = self.snapshot(); + let analysis = self.snapshot().analysis; move |sender| { let cb = |progress| { sender.send(Task::PrimeCaches(progress)).unwrap(); }; - match snap.analysis.prime_caches(cb) { + match analysis.prime_caches(cb) { Ok(()) => (), Err(_canceled) => (), }