Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--.github/workflows/ci.yaml6
-rw-r--r--.github/workflows/metrics.yaml2
-rw-r--r--Cargo.toml2
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs28
-rw-r--r--crates/rust-analyzer/src/cli/flags.rs3
-rw-r--r--crates/span/src/map.rs1
-rw-r--r--crates/syntax/src/lib.rs1
7 files changed, 34 insertions, 9 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e3384c976b..5975272d87 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -16,6 +16,7 @@ env:
CI: 1
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
+ RUSTFLAGS: "-D warnings -W unreachable-pub --cfg no_salsa_async_drops"
defaults:
run:
@@ -41,8 +42,6 @@ jobs:
if: github.repository == 'rust-lang/rust-analyzer'
name: proc-macro-srv
runs-on: ubuntu-latest
- env:
- RUSTFLAGS: "-D warnings"
steps:
- name: Checkout repository
@@ -80,7 +79,6 @@ jobs:
name: Rust
runs-on: ${{ matrix.os }}
env:
- RUSTFLAGS: "-Dwarnings"
CC: deny_c
strategy:
@@ -207,8 +205,6 @@ jobs:
# crate should
- target: wasm32-unknown-unknown
ide-only: true
- env:
- RUSTFLAGS: "-Dwarnings"
steps:
- name: Checkout repository
diff --git a/.github/workflows/metrics.yaml b/.github/workflows/metrics.yaml
index dc2f432bbc..fc1cae55c9 100644
--- a/.github/workflows/metrics.yaml
+++ b/.github/workflows/metrics.yaml
@@ -7,7 +7,7 @@ on:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
- RUSTFLAGS: "-D warnings -W unreachable-pub"
+ RUSTFLAGS: "-D warnings -W unreachable-pub -cfg no_salsa_async_drops"
RUSTUP_MAX_RETRIES: 10
jobs:
diff --git a/Cargo.toml b/Cargo.toml
index 35f2fe4a95..a7f1e174dc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -184,7 +184,7 @@ hashbrown = { version = "0.14.*", features = [
elided_lifetimes_in_paths = "warn"
explicit_outlives_requirements = "warn"
unsafe_op_in_unsafe_fn = "warn"
-unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bootstrap)'] }
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bootstrap)', "cfg(no_salsa_async_drops)"] }
unused_extern_crates = "warn"
unused_lifetimes = "warn"
unreachable_pub = "warn"
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index 395a59c438..59a4de953c 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -11,7 +11,7 @@ use std::{
use cfg::{CfgAtom, CfgDiff};
use hir::{
Adt, AssocItem, Crate, DefWithBody, FindPathConfig, HasCrate, HasSource, HirDisplay, ModuleDef,
- Name,
+ Name, crate_lang_items,
db::{DefDatabase, ExpandDatabase, HirDatabase},
next_solver::{DbInterner, GenericArgs},
};
@@ -200,7 +200,7 @@ impl flags::AnalysisStats {
let mut num_crates = 0;
let mut visited_modules = FxHashSet::default();
let mut visit_queue = Vec::new();
- for krate in krates {
+ for &krate in &krates {
let module = krate.root_module();
let file_id = module.definition_source_file_id(db);
let file_id = file_id.original_file(db);
@@ -313,6 +313,10 @@ impl flags::AnalysisStats {
}
hir::attach_db(db, || {
+ if !self.skip_lang_items {
+ self.run_lang_items(db, &krates, verbosity);
+ }
+
if !self.skip_lowering {
self.run_body_lowering(db, &vfs, &bodies, verbosity);
}
@@ -1109,6 +1113,26 @@ impl flags::AnalysisStats {
report_metric("body lowering time", body_lowering_time.time.as_millis() as u64, "ms");
}
+ fn run_lang_items(&self, db: &RootDatabase, crates: &[Crate], verbosity: Verbosity) {
+ let mut bar = match verbosity {
+ Verbosity::Quiet | Verbosity::Spammy => ProgressReport::hidden(),
+ _ if self.output.is_some() => ProgressReport::hidden(),
+ _ => ProgressReport::new(crates.len()),
+ };
+
+ let mut sw = self.stop_watch();
+ bar.tick();
+ for &krate in crates {
+ crate_lang_items(db, krate.into());
+ bar.inc(1);
+ }
+
+ bar.finish_and_clear();
+ let time = sw.elapsed();
+ eprintln!("{:<20} {}", "Crate lang items:", time);
+ report_metric("crate lang items time", time.time.as_millis() as u64, "ms");
+ }
+
/// Invariant: `file_ids` must be sorted and deduped before passing into here
fn run_ide_things(
&self,
diff --git a/crates/rust-analyzer/src/cli/flags.rs b/crates/rust-analyzer/src/cli/flags.rs
index 75030bedfc..c522060181 100644
--- a/crates/rust-analyzer/src/cli/flags.rs
+++ b/crates/rust-analyzer/src/cli/flags.rs
@@ -78,6 +78,8 @@ xflags::xflags! {
optional --disable-proc-macros
/// Run the proc-macro-srv binary at the specified path.
optional --proc-macro-srv path: PathBuf
+ /// Skip lang items fetching.
+ optional --skip-lang-items
/// Skip body lowering.
optional --skip-lowering
/// Skip type inference.
@@ -256,6 +258,7 @@ pub struct AnalysisStats {
pub disable_proc_macros: bool,
pub proc_macro_srv: Option<PathBuf>,
pub skip_lowering: bool,
+ pub skip_lang_items: bool,
pub skip_inference: bool,
pub skip_mir_stats: bool,
pub skip_data_layout: bool,
diff --git a/crates/span/src/map.rs b/crates/span/src/map.rs
index 83b2413676..d14c497474 100644
--- a/crates/span/src/map.rs
+++ b/crates/span/src/map.rs
@@ -156,6 +156,7 @@ where
}
}
+#[cfg(not(no_salsa_async_drops))]
impl<S> Drop for SpanMap<S> {
fn drop(&mut self) {
struct SendPtr(*mut [()]);
diff --git a/crates/syntax/src/lib.rs b/crates/syntax/src/lib.rs
index 27d288953b..7346b93192 100644
--- a/crates/syntax/src/lib.rs
+++ b/crates/syntax/src/lib.rs
@@ -200,6 +200,7 @@ impl ast::Expr {
}
}
+#[cfg(not(no_salsa_async_drops))]
impl<T> Drop for Parse<T> {
fn drop(&mut self) {
let Some(green) = self.green.take() else {