-
Notifications
You must be signed in to change notification settings - Fork 1.8k
analyzer: code is inactive due to #[cfg] directives: doc is disabled #14395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Rust-analyzer can only analyze one |
cool - that makes sense. It's a bit of a bummer, but an understandable one. |
I believe it uses the default of rustc for the respective target + all features enabled when the root is compiled with |
Is there an easy way to enable I tried setting
|
I'm also looking for a way to enable all features, since |
You can set |
When I set
If I set it to a specific feature it seems to work fine. Not sure what I'm missing. |
@nine9ths Try |
Perhaps there could be something similar to |
By that logic we'd also have to have a warning in every function guarded by a proc-macro, because a lot of features also don't work in there. I think we can agree that having that would be nonsense, so I am not convinced that this is a good reason.
Since the name of the reported diagnostic seems to be |
IDE features work fine in proc macros (albeit sometimes they can be slower). The only exception I can think of is inlay hints which are intentionally disabled. Also, it's clear when a code is inside a macro, but not when a cfg is disabled.
Having kebab case will indeed be a problem (although it's solvable). Perhaps |
The inactive-code check appears to false positive (IMO) on
#[cfg(doc)]
.Sample code
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
cfg(doc)
code blocks in the inactive-code analyzer.Open to other ideas to solve.
The text was updated successfully, but these errors were encountered: