Skip to content

Extend dead code detection to cover files that are not loaded #12565

Closed
@chris-morgan

Description

@chris-morgan

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 named test.rs or tests.rs and the contents of directories named test or tests 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions