Unnamed repository; edit this file 'description' to name the repository.
internal: prep to 2021 edition
Aleksey Kladov 2021-08-20
parent 2fbe1c9 · commit 1850849
-rw-r--r--.github/workflows/ci.yaml2
-rw-r--r--crates/hir_expand/src/lib.rs8
-rw-r--r--crates/rust-analyzer/src/dispatch.rs6
-rw-r--r--crates/rust-analyzer/src/main_loop.rs4
4 files changed, 11 insertions, 9 deletions
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<SyntaxToken> {
self,
db: &dyn db::AstDatabase,
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ {
- 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::<R>(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) => (),
}