rust-lang / rust-lang/rust-analyzer

Child modules of module marked as #[cfg(test)] are considered disabled

Open
#18,389 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: rust-analyzer version: 0.4.2145-standalone (d7628c0a8 2024-10-12) [/Users/sytten/.vscode/extensions/rust-lang.rust-analyzer-0.4.2145-darwin-arm64/server/rust-analyzer]

rustc version: rustc 1.81.0 (eeb90cda1 2024-09-04)

editor or extension: VSCode

If you have the structure

src
│   lib.rs
│
├── tests
│   ├── mod.rs
│   └── a.rs

in lib.rs you have

#[cfg(test)]
mod tests

in mod.rs you have

mod a;

Then the test cases in a.rs are marked as unlisted: This file is not included anywhere in the module tree, so rust-analyzer can't offer IDE services

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 minimal module tree using lib.rs, tests/mod.rs, and tests/a.rs, with tests declared under #[cfg(test)]. Then trace rust-analyzer's handling of these module declarations and verify that a.rs is included in the module tree rather than marked unlisted, with IDE services available there.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.