rust-lang / rust-lang/rust-analyzer
analyzer: code is inactive due to #[cfg] directives: doc is disabled
Open
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
The inactive-code check appears to false positive (IMO) on #[cfg(doc)].
Sample code
#[cfg(doc)]
use std::future::Future;
/// Handy struct that pairs well with [`Future`].
pub struct Past;
One could potentially argue that this is behaving-as-designed, since it's analyzing the code, but not the docs - but I found it a bit un-useful.
Some possible proposed solutions
- not include
cfg(doc)code blocks in the inactive-code analyzer. - Include docstrings in the analyzer
Open to other ideas to solve.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided #[cfg(doc)] reproduction and trace how the inactive-code analyzer handles cfg directives and documentation links. Compare the proposed options, then establish the expected behavior and add a regression test covering the sample code and its [Future] reference.
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
- Mostly clear
- Newbie friendliness
- 35/100