1
Fork 0

Only require symbol name for @feature_gate

This commit is contained in:
Michael Goulet 2024-06-27 15:27:52 -04:00
parent e9e6e2e444
commit 6f3ad0a40b
5 changed files with 18 additions and 20 deletions

View file

@ -9,7 +9,6 @@
use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
use rustc_span::edition::Edition;
use rustc_span::symbol::sym;
declare_lint_pass! {
/// Does nothing as a lint pass, but registers some `Lint`s
@ -461,7 +460,7 @@ declare_lint! {
pub MUST_NOT_SUSPEND,
Allow,
"use of a `#[must_not_suspend]` value across a yield point",
@feature_gate = rustc_span::symbol::sym::must_not_suspend;
@feature_gate = must_not_suspend;
}
declare_lint! {
@ -1645,7 +1644,7 @@ declare_lint! {
pub RUST_2024_INCOMPATIBLE_PAT,
Allow,
"detects patterns whose meaning will change in Rust 2024",
@feature_gate = sym::ref_pat_eat_one_layer_2024;
@feature_gate = ref_pat_eat_one_layer_2024;
// FIXME uncomment below upon stabilization
/*@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
@ -2693,7 +2692,7 @@ declare_lint! {
pub FUZZY_PROVENANCE_CASTS,
Allow,
"a fuzzy integer to pointer cast is used",
@feature_gate = sym::strict_provenance;
@feature_gate = strict_provenance;
}
declare_lint! {
@ -2739,7 +2738,7 @@ declare_lint! {
pub LOSSY_PROVENANCE_CASTS,
Allow,
"a lossy pointer to integer cast is used",
@feature_gate = sym::strict_provenance;
@feature_gate = strict_provenance;
}
declare_lint! {
@ -3923,7 +3922,7 @@ declare_lint! {
pub NON_EXHAUSTIVE_OMITTED_PATTERNS,
Allow,
"detect when patterns of types marked `non_exhaustive` are missed",
@feature_gate = sym::non_exhaustive_omitted_patterns_lint;
@feature_gate = non_exhaustive_omitted_patterns_lint;
}
declare_lint! {
@ -4043,7 +4042,7 @@ declare_lint! {
pub TEST_UNSTABLE_LINT,
Deny,
"this unstable lint is only for testing",
@feature_gate = sym::test_unstable_lint;
@feature_gate = test_unstable_lint;
}
declare_lint! {

View file

@ -865,7 +865,7 @@ macro_rules! declare_lint {
);
);
($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
$(@feature_gate = $gate:expr;)?
$(@feature_gate = $gate:ident;)?
$(@future_incompatible = FutureIncompatibleInfo {
reason: $reason:expr,
$($field:ident : $val:expr),* $(,)*
@ -879,7 +879,7 @@ macro_rules! declare_lint {
desc: $desc,
is_externally_loaded: false,
$($v: true,)*
$(feature_gate: Some($gate),)?
$(feature_gate: Some(rustc_span::symbol::sym::$gate),)?
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
reason: $reason,
$($field: $val,)*
@ -895,21 +895,21 @@ macro_rules! declare_lint {
macro_rules! declare_tool_lint {
(
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr
$(, @feature_gate = $gate:expr;)?
$(, @feature_gate = $gate:ident;)?
) => (
$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,
report_in_external_macro: $rep:expr
$(, @feature_gate = $gate:expr;)?
$(, @feature_gate = $gate:ident;)?
) => (
$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,
$external:expr
$(, @feature_gate = $gate:expr;)?
$(, @feature_gate = $gate:ident;)?
) => (
$(#[$attr])*
$vis static $NAME: &$crate::Lint = &$crate::Lint {
@ -920,7 +920,7 @@ macro_rules! declare_tool_lint {
report_in_external_macro: $external,
future_incompatible: None,
is_externally_loaded: true,
$(feature_gate: Some($gate),)?
$(feature_gate: Some(rustc_span::symbol::sym::$gate),)?
crate_level_only: false,
..$crate::Lint::default_fields_for_macro()
};