Allow tool-lints to specify a feature-gate too
This commit is contained in:
parent
7f115e3cd2
commit
fd1a399c4f
2 changed files with 11 additions and 5 deletions
|
@ -440,8 +440,10 @@ impl<'s> LintLevelsBuilder<'s> {
|
||||||
sp,
|
sp,
|
||||||
reason,
|
reason,
|
||||||
);
|
);
|
||||||
for id in ids {
|
for &id in ids {
|
||||||
self.insert_spec(*id, (level, src));
|
if self.check_gated_lint(id, attr.span) {
|
||||||
|
self.insert_spec(id, (level, src));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if let Level::Expect(expect_id) = level {
|
if let Level::Expect(expect_id) = level {
|
||||||
self.lint_expectations.push((
|
self.lint_expectations.push((
|
||||||
|
|
|
@ -658,18 +658,21 @@ macro_rules! declare_lint {
|
||||||
macro_rules! declare_tool_lint {
|
macro_rules! declare_tool_lint {
|
||||||
(
|
(
|
||||||
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr
|
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr
|
||||||
|
$(, @feature_gate = $gate:expr;)?
|
||||||
) => (
|
) => (
|
||||||
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false}
|
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false $(, @feature_gate = $gate;)?}
|
||||||
);
|
);
|
||||||
(
|
(
|
||||||
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
|
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
|
||||||
report_in_external_macro: $rep:expr
|
report_in_external_macro: $rep:expr
|
||||||
|
$(, @feature_gate = $gate:expr;)?
|
||||||
) => (
|
) => (
|
||||||
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep}
|
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep $(, @feature_gate = $gate;)?}
|
||||||
);
|
);
|
||||||
(
|
(
|
||||||
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
|
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
|
||||||
$external:expr
|
$external:expr
|
||||||
|
$(, @feature_gate = $gate:expr;)?
|
||||||
) => (
|
) => (
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
$vis static $NAME: &$crate::Lint = &$crate::Lint {
|
$vis static $NAME: &$crate::Lint = &$crate::Lint {
|
||||||
|
@ -680,8 +683,9 @@ macro_rules! declare_tool_lint {
|
||||||
report_in_external_macro: $external,
|
report_in_external_macro: $external,
|
||||||
future_incompatible: None,
|
future_incompatible: None,
|
||||||
is_plugin: true,
|
is_plugin: true,
|
||||||
feature_gate: None,
|
$(feature_gate: Some($gate),)?
|
||||||
crate_level_only: false,
|
crate_level_only: false,
|
||||||
|
..$crate::Lint::default_fields_for_macro()
|
||||||
};
|
};
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue