-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Extend dead code detection to cover files that are not loaded #12565
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
I'm not sure which files this is meant to trigger for. E.g. in my projects I have a directory It seems like this would have too many false positives and (or false negatives depending on how you handle the above case) in legitimate directory structures. |
@SiegeLord I see your point there. I see several primary options (mutually inclusive):
|
I've started working on a compiler plugin that adds a lint to detect unused files. At the moment, it only analysis a single crate (e.g. |
Since new lints have a big impact on users of rustc, the policy is that they should go through the RFC process like other user-facing changes. As such, I'm going to give this one a close, but if anyone comes across this ticket and wants this lint, consider adding it to clippy and/or writing up an RFC. Thanks! |
internal: More completion refactors
If I have a whole tree of
*.rs
files and one of them is not included in the compilation, that is probably an error on my part. I propose a new lint to this effect.When compiling without
cfg(test)
, I suggest that files namedtest.rs
ortests.rs
and the contents of directories namedtest
ortests
be ignored.To suppress this lint for individual files, we would add an attribute such as
#[allow_unloaded_file = "foo.rs"]
. That could go on a module in the appropriate place in the filesystem or on the crate itself.This occurred to me when I found
src/librustc/middle/typeck/infer/test.rs
with a few syntax errors (#12564).The text was updated successfully, but these errors were encountered: