-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 #66079 (comment), ``@chorman0773`` r? ``@petrochenkov``
- Loading branch information
Showing
9 changed files
with
112 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)]` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters