rust-lang / rust-lang/rust-analyzer

`rust-analyzer analysis-stats` doesn't respect `excludeDirs`

Open
#19,779 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer 1.87.0-nightly (4d30011 2025-03-15) (using old Salsa, because it uses 2 times less RAM)
rustc version: rustc 1.87.0-nightly (4d30011f6 2025-03-15)

editor or extension: LazyVim (nvim v0.11.0)

relevant settings:

rust-analyzer.json

{
  "rust-analyzer.cargo.features": [],
  "rust-analyzer.cargo.allTargets": false,
  "rust-analyzer.check.allTargets": false,
  "rust-analyzer.cfg.setTest": true,
  "rust-analyzer.checkOnSave": false,
  "rust-analyzer.cachePriming.enable": true,
  "rust-analyzer.files.excludeDirs": [
    "crates/db_diesel/src/schema.rs",
    "f2c/src/processing/withdrawal_flows/db/action/",
    "[redacted]..."
  ]
}

rust-analyzer.toml in workspace root

# Disables all inlay hints
[inlayHints]
typeHints.enable = false
parameterHints.enable = false
chainingHints.enable = false
closureReturnTypeHints.enable = false
bindingModeHints.enable = false
discriminantHints.enable = false
closureCaptureHints.enable = false

[references]
excludeImports = true

[files]
excludeDirs = [
  "crates/db_diesel/src/schema.rs",
  "f2c/src/withdrawals/db/action/",
  "[redacted]",
]

repository link (if public, optional): private

Expected behaviour: rust-analyzer skips lowering, type inference and trait solving for files and directories mentioned in files.excludeDirs

Actual behaviour:

6/23404 7% processing: f2c::processing::withdrawal_flows::db::action::storage::update_processing_exchange::handle (f2c/src/processing/withdrawal_flows/db/action/storage/update_processing_exchange.rs 954..1715)    7694ms infer_query
      7270ms resolve_obligations_as_possible (444 calls)
        7266ms trait_solve_query @ detail = "SqlType"  (24 calls)
          7265ms solve  @ krate = Idx::<CrateData>(29) block = None  (24 calls)
8/23404 7% processing: f2c::processing::withdrawal_flows::db::action::storage::update_processing_conversion::handle (f2c/src/processing/withdrawal_flows/db/action/storage/update_processing_conversion.rs 960..1786)    7674ms infer_query
      7252ms resolve_obligations_as_possible (444 calls)
        7247ms trait_solve_query @ detail = "SqlType"  (24 calls)
          7247ms solve  @ krate = Idx::<CrateData>(29) block = None  (24 calls)
70/23404 7% processing: f2c::processing::withdrawal_flows::db::action::storage::update_preparing_withdrawal::handle (f2c/src/processing/withdrawal_flows/db/action/storage/update_preparing_withdrawal.rs 931..1690)   10054ms infer_query
      9704ms resolve_obligations_as_possible (439 calls)
        9701ms trait_solve_query @ detail = "AsExpression"  (16 calls)
          9701ms solve  @ krate = Idx::<CrateData>(29) block = None  (16 calls)
2/23404 7% processing: f2c::processing::withdrawal_flows::db::action::storage::update_preparing_conversion::handle (f2c/src/processing/withdrawal_flows/db/action/storage/update_preparing_conversion.rs 931..1745)    9974ms infer_query
      9630ms resolve_obligations_as_possible (439 calls)
        9626ms trait_solve_query @ detail = "AsExpression"  (16 calls)
          9626ms solve  @ krate = Idx::<CrateData>(29) block = None  (16 calls)
4/23404 7% processing: f2c::processing::withdrawal_flows::db::action::storage::update_failed::handle (f2c/src/processing/withdrawal_flows/db/action/storage/update_failed.rs 810..1230)    6486ms infer_query
      6413ms resolve_obligations_as_possible (352 calls)
        6410ms trait_solve_query @ detail = "AsExpression"  (15 calls)
          6410ms solve  @ krate = Idx::<CrateData>(29) block = None  (15 calls)
6/23404 7% processing: f2c::processing::withdrawal_flows::db::action::storage::update_deposited::handle (f2c/src/processing/withdrawal_flows/db/action/storage/update_deposited.rs 828..1255)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rust-analyzer analysis-stats command and its handling of rust-analyzer.toml [files].excludeDirs. Reproduce the report using the supplied configuration, then trace why excluded files still reach lowering, type inference, and trait solving. Done means analysis-stats skips the listed files and directories as described in the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.