rust-lang / rust-lang/rust-analyzer

Diagnostics not available for some crates in multiple crate projects

Open
#19,674 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
Version 0.3.2433 (723121e5 2025-04-21)

rustc version: (eg. output of rustc -V) 1.85.1

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
Nnvim (Rustaecanvim), VSCode

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
I've tried default (for VScode and Nvim) and highly customized nvim:

    "mrcjkb/rustaceanvim",
    version = '^6',
    lazy = false,
    opts = {
        server = {
            -- cmd = { vim.fn.expand("/opt/homebrew/bin/rust-analyzer") },
            settings = {
                ["rust-analyzer"] = {
                    cargo = {
                        buildScripts = {enable = true},
                        extraEnv = { CARGO_TARGET_DIR = ".ra_target" },
                        allFeatures = true,
                        loadOutDirsFromCheck = true,
                        targetDir = ".ra_target",
                    },
                    files = {
                        excludeDirs = {
                            "build",
                            ".direnv",
                            ".git",
                            ".github",
                            ".gitlab",
                            "bin",
                            "node_modules",
                            "target",
                            "venv",
                            ".venv",
                            ".ra_target",
                        }
                    },
                    completion = {
                        fullFunctionSignatures = { enable = true },
                        limit = 100,
                    },
                    diagnostics = {
                        enable = true,
                        experimental = true,
                        disabled = {
                            "unresolved-proc-macro",
                        },
                        styleLints = { enable = true },
                    },
                    hover = {
                        actions = {
                            references = { enable = true },
                        },
                        show = {
                            enumVariants = 10,
                            fields = 10,
                        },
                    },
                    inlayHints = {
                        closingBraceHints = {
                            enable = true,
                            minLines = 35,
                        },
                        -- closureCaptureHints = { enable = true }, -- TODO: make toggle-able
                        closureReturnTypeHints = { enable = "block" },
                        expressionAdjustmentHints = {
                            enable = true,
                            hideOutsideUnsafe = true,
                        },
                        genericParameterHints = {
                            lifetime = { enable = true },
                            type = { enable = true },
                        },
                    },
                    workspace = {
                        symbol = {
                            search = {
                                limit = 512,
                            },
                        },
                    },
                },
            },
        },
    },

code snippet to reproduce:
I have 3 crates in ./crates/
Each is listed under [workspace] members = []
I've tried re-arranging members[] didn't help
The crate that gets diagnostics is shared between the 2 that do not.
In previous version of RA this wasn't an issue, but I do not know when it stopped as I don't always work between all 3 crates.

repro:
Go to a uncommon crate, make an intentional error, get no diagnostics
Go to common crate in the same project, make intentional error, get diagnostics

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

Reproduce the problem with three crates listed in the Cargo workspace members array, introducing an intentional error first in an uncommon crate and then in the shared crate. Trace how rust-analyzer diagnostics are produced for each crate; done means intentional errors receive diagnostics consistently across all workspace crates, with regression coverage for this layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.