Skip to content

Lints could have error codes #24900

Closed
Closed
@huonw

Description

@huonw

Lint messages don't always explain the error in much detail, and so would often benefit from a detailed --explain explanation just like normal errors, e.g. this will hit a dead_code warning, but that doesn't really help diagnose the problem (that mod foo; is private), a detailed explanation could include discussion of the privacy/modules aspect of the lint.

#![crate_type = "lib"]
mod foo;
// foo.rs
pub fn bar() {}
foo.rs:2:1: 2:12 warning: function is never used: `bar`, #[warn(dead_code)] on by default
foo.rs:2 fn bar() {}
         ^~~~~~~~~~~

It might also make sense to have a generic "lints" detailed explanation, that (a) lints that don't have their own error message point to, and (b) that any specific lint explanation also points to ("see also [E...] for more on lints"). This could include the common details of how the allow/etc. attributes work.

On the other hand, lints may change too fast for this to make sense.

cc @michaelsproul #24407

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions