Closed
Description
Problem
This came up during the discussion of rust-lang/cargo#5034. Lints can be broken into rustc builtin lints, and lints supplied by a tool such as clippy. For clippy lints, they are prefixed by clippy::
. The idea is that external lints are supposed to be ignored if the tool is not active. This works for lints controlled through attributes, such as #![allow(clippy::foo)]
.
Unfortunately the same thing doesn't work when allowing the lint through the command line, doing rustc -A clippy::foo
.
Steps
- Run
rustc -A clippy::foo test.rs
Possible Solution(s)
The problem is at:
rust/compiler/rustc_lint/src/context.rs
Line 345 in 4733f32
There is a hard-coded
None
passed in as the tool name in check_lint_name
.
Activity
eholk commentedon Jun 25, 2021
I'm working on a fix at https://github.com/eholk/rust/tree/lint-tool. The fix there so far is doing an ad-hoc parsing, although it seems like it'd be better to reuse the rustc parser for paths, since that is how the attribute version is parsed. I'm going to clean it up some more, make sure to add tests, etc. before filing an PR.
eholk commentedon Jun 25, 2021
@rustbot claim
inquisitivecrystal commentedon Jun 28, 2021
@rustbot label A-lint T-compiler
Rollup merge of rust-lang#86639 - eholk:lint-tool, r=petrochenkov
Rollup merge of rust-lang#86639 - eholk:lint-tool, r=petrochenkov