Repository navigation
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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_gatefield of typeOption<Symbol>for therustc_session::lint::Lintstruct, which has aSomevalue if the lint is feature-gated,Noneotherwise. - 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_linkshould 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
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
nikomatsakis commentedon May 28, 2020
This implementation plan looks good to me -- if you think @LeSeulArtichaut that you'd like to mentor the issue, maybe tag it with E-easy and E-mentor! I'd probably extend the description above with
unsafe_op_in_unsafe_fnlint, which I think is basically the model that we want to follow.rajatppn commentedon May 28, 2020
Hi, I would like to take this up if possible. I'm new to contributing to rust
LeSeulArtichaut commentedon May 28, 2020
@rajatppn That's great! I edited the original post to give you links to the code you'll need to edit. I'd recommand that you base your work on #71862 so that you can immediately make changes for
unsafe_op_in_unsafe_fnand use that as a test.LeSeulArtichaut commentedon May 29, 2020
Also, to show that you're working on an issue, you can send
@rustbot claim, which will assign the issue to you.OddCoincidence commentedon May 30, 2020
@rajatppn Are you still working on this? If not, I'd like to claim it.
carsonmyers commentedon Jun 3, 2020
I'm also interested, looking for a first ticket
LeSeulArtichaut commentedon Jun 4, 2020
I'll assign this to @OddCoincidence (who opened a PR) for triage purposes.
@rustbot assign @OddCoincidence
@carsonmyers Good luck on finding a first issue! If you don't find anything, you can probably go in the Rust Zulip instance and ask for issues,
@DPCwill probably happily to find you one 😄Rollup merge of rust-lang#72970 - OddCoincidence:feature-gated-lints,…
Rollup merge of rust-lang#72970 - OddCoincidence:feature-gated-lints,…
Rollup merge of rust-lang#72970 - OddCoincidence:feature-gated-lints,…