Closed
Description
At the moment, the unsafe_op_in_unsafe_fn
lint is the only feature-gated lint. However, feature-gate checks are hard-coded for this lint. If more feature gated lints are be added in the future, having proper handling for feature-gated lint will be useful.
Here is a suggested implementation plan:
- Add a
feature_gate
field of typeOption<Symbol>
for therustc_session::lint::Lint
struct, which has aSome
value if the lint is feature-gated,None
otherwise. - Tweak the
rustc_session::declare_lint!
macro to allow specifying the feature gate when applicable, akin tofuture_incompatible
. - When registering lints on the command line or for attributes, check if they are feature gated, and report errors accordingly. Basically, re-writing
check_gated_link
should be enough. - As rustdoc allows all lints as if they were passed on the command line, prevent rustdoc from allowing feature gated lints.
This issue has been assigned to @OddCoincidence via this comment.
Metadata
Metadata
Assignees
Labels
Area: Lints (warnings about flaws in source code) such as unused_mut.Category: PRs that clean code up or issues documenting cleanup.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.