Skip to content

Commit 4b466ee

Browse files
committed
Introduce the declare_tool_lint macro
1 parent 4234adf commit 4b466ee

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/librustc/lint/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,26 @@ macro_rules! declare_lint {
139139
);
140140
}
141141

142+
#[macro_export]
143+
macro_rules! declare_tool_lint {
144+
($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr) => (
145+
declare_tool_lint!{$vis $tool::$NAME, $Level, $desc, false}
146+
);
147+
($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr,
148+
report_in_external_macro: $rep: expr) => (
149+
declare_tool_lint!{$vis $tool::$NAME, $Level, $desc, $rep}
150+
);
151+
($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr, $external: expr) => (
152+
$vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
153+
name: &concat!(stringify!($tool), "::", stringify!($NAME)),
154+
default_level: $crate::lint::$Level,
155+
desc: $desc,
156+
edition_lint_opts: None,
157+
report_in_external_macro: $external,
158+
};
159+
);
160+
}
161+
142162
/// Declare a static `LintArray` and return it as an expression.
143163
#[macro_export]
144164
macro_rules! lint_array {

0 commit comments

Comments
 (0)