diff options
| author | kennytm <kennytm@gmail.com> | 2019-03-02 14:55:14 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2019-03-02 22:58:26 +0800 |
| commit | 4aebce5758eec173351784b88678cb85eeafeb36 (patch) | |
| tree | 334c0a8a8f1b318f863e2a8e717b3a372b0df84c | |
| parent | f67736ad04e4e727a62a59e94570467aaf9042d9 (diff) | |
| parent | a998b1f425bc13d891ed5b28f1b708970f9db4b4 (diff) | |
| download | rust-4aebce5758eec173351784b88678cb85eeafeb36.tar.gz rust-4aebce5758eec173351784b88678cb85eeafeb36.zip | |
Rollup merge of #58785 - euclio:tool-lint-attrs, r=estebank
allow specifying attributes for tool lints Needed for clippy to fix `unused_doc_comments` warnings that will be exposed by #57882 (and thus unblock it).
| -rw-r--r-- | src/librustc/lint/mod.rs | 20 | ||||
| -rw-r--r-- | src/test/ui-fulldeps/auxiliary/lint_tool_test.rs | 6 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index dd003e44bea..496ff568b31 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -132,14 +132,22 @@ macro_rules! declare_lint { #[macro_export] macro_rules! declare_tool_lint { - ($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr) => ( - declare_tool_lint!{$vis $tool::$NAME, $Level, $desc, false} + ( + $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr + ) => ( + declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false} ); - ($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr, - report_in_external_macro: $rep: expr) => ( - declare_tool_lint!{$vis $tool::$NAME, $Level, $desc, $rep} + ( + $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr, + report_in_external_macro: $rep:expr + ) => ( + declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep} ); - ($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr, $external: expr) => ( + ( + $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr, + $external:expr + ) => ( + $(#[$attr])* $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint { name: &concat!(stringify!($tool), "::", stringify!($NAME)), default_level: $crate::lint::$Level, diff --git a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs index 1a9bd9e66db..d25a5ea3746 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs @@ -13,7 +13,11 @@ use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, use rustc_plugin::Registry; use syntax::ast; declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); -declare_tool_lint!(pub clippy::TEST_GROUP, Warn, "Warn about other stuff"); +declare_tool_lint!( + /// Some docs + pub clippy::TEST_GROUP, + Warn, "Warn about other stuff" +); struct Pass; |
