Rollup merge of #83216 - jyn514:register-tool, r=petrochenkov
Allow registering tool lints with `register_tool` Previously, there was no way to add a custom tool prefix, even if the tool itself had registered a lint: ```rust #![feature(register_tool)] #![register_tool(xyz)] #![warn(xyz::my_lint)] ``` ``` $ rustc unknown-lint.rs --crate-type lib error[E0710]: an unknown tool name found in scoped lint: `xyz::my_lint` --> unknown-lint.rs:3:9 | 3 | #![warn(xyz::my_lint)] | ^^^ ``` This allows opting-in to lints from other tools using `register_tool`. cc https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, ``@chorman0773`` r? ``@petrochenkov``
This commit is contained in:
commit
bcb9226efb
9 changed files with 112 additions and 32 deletions
11
src/test/ui/lint/register-tool-lint.rs
Normal file
11
src/test/ui/lint/register-tool-lint.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#![crate_type = "lib"]
|
||||
#![feature(register_tool)]
|
||||
#![register_tool(xyz)]
|
||||
#![warn(xyz::my_lint)] // this should not error
|
||||
#![warn(abc::my_lint)]
|
||||
//~^ ERROR unknown tool name `abc` found in scoped lint
|
||||
//~| HELP add `#![register_tool(abc)]`
|
||||
//~| ERROR unknown tool name `abc`
|
||||
//~| HELP add `#![register_tool(abc)]`
|
||||
//~| ERROR unknown tool name `abc`
|
||||
//~| HELP add `#![register_tool(abc)]`
|
||||
27
src/test/ui/lint/register-tool-lint.stderr
Normal file
27
src/test/ui/lint/register-tool-lint.stderr
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
error[E0710]: unknown tool name `abc` found in scoped lint: `abc::my_lint`
|
||||
--> $DIR/register-tool-lint.rs:5:9
|
||||
|
|
||||
LL | #![warn(abc::my_lint)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(abc)]` to the crate root
|
||||
|
||||
error[E0710]: unknown tool name `abc` found in scoped lint: `abc::my_lint`
|
||||
--> $DIR/register-tool-lint.rs:5:9
|
||||
|
|
||||
LL | #![warn(abc::my_lint)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(abc)]` to the crate root
|
||||
|
||||
error[E0710]: unknown tool name `abc` found in scoped lint: `abc::my_lint`
|
||||
--> $DIR/register-tool-lint.rs:5:9
|
||||
|
|
||||
LL | #![warn(abc::my_lint)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(abc)]` to the crate root
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0710`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#[warn(foo::bar)]
|
||||
//~^ ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~^ ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,26 @@
|
|||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/tool_lints.rs:1:8
|
||||
|
|
||||
LL | #[warn(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/tool_lints.rs:1:8
|
||||
|
|
||||
LL | #[warn(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/tool_lints.rs:1:8
|
||||
|
|
||||
LL | #[warn(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
#![deny(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
|
||||
#[allow(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
|
||||
#[allow(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,50 @@
|
|||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/unknown-lint-tool-name.rs:1:9
|
||||
|
|
||||
LL | #![deny(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/unknown-lint-tool-name.rs:5:9
|
||||
|
|
||||
LL | #[allow(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/unknown-lint-tool-name.rs:1:9
|
||||
|
|
||||
LL | #![deny(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/unknown-lint-tool-name.rs:5:9
|
||||
|
|
||||
LL | #[allow(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/unknown-lint-tool-name.rs:1:9
|
||||
|
|
||||
LL | #![deny(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
|
||||
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
|
||||
--> $DIR/unknown-lint-tool-name.rs:5:9
|
||||
|
|
||||
LL | #[allow(foo::bar)]
|
||||
| ^^^
|
||||
|
|
||||
= help: add `#![register_tool(foo)]` to the crate root
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue