Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -80,7 +79,6 @@ jobs:
name: Rust
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: "-Dwarnings"
CC: deny_c

strategy:
Expand Down Expand Up @@ -207,8 +205,6 @@ jobs:
# crate should
- target: wasm32-unknown-unknown
ide-only: true
env:
RUSTFLAGS: "-Dwarnings"

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
28 changes: 26 additions & 2 deletions crates/rust-analyzer/src/cli/analysis_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions crates/rust-analyzer/src/cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions crates/span/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ where
}
}

#[cfg(not(no_salsa_async_drops))]
impl<S> Drop for SpanMap<S> {
fn drop(&mut self) {
struct SendPtr(*mut [()]);
Expand Down
1 change: 1 addition & 0 deletions crates/syntax/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down