Only require symbol name for @feature_gate
This commit is contained in:
parent
e9e6e2e444
commit
6f3ad0a40b
5 changed files with 18 additions and 20 deletions
|
@ -11,7 +11,7 @@ use rustc_middle::ty::{
|
||||||
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
|
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
|
||||||
};
|
};
|
||||||
use rustc_session::{declare_lint, declare_lint_pass};
|
use rustc_session::{declare_lint, declare_lint_pass};
|
||||||
use rustc_span::{sym, Span};
|
use rustc_span::Span;
|
||||||
|
|
||||||
use crate::fluent_generated as fluent;
|
use crate::fluent_generated as fluent;
|
||||||
use crate::{LateContext, LateLintPass};
|
use crate::{LateContext, LateLintPass};
|
||||||
|
@ -57,7 +57,7 @@ declare_lint! {
|
||||||
pub IMPL_TRAIT_OVERCAPTURES,
|
pub IMPL_TRAIT_OVERCAPTURES,
|
||||||
Allow,
|
Allow,
|
||||||
"`impl Trait` will capture more lifetimes than possibly intended in edition 2024",
|
"`impl Trait` will capture more lifetimes than possibly intended in edition 2024",
|
||||||
@feature_gate = sym::precise_capturing;
|
@feature_gate = precise_capturing;
|
||||||
//@future_incompatible = FutureIncompatibleInfo {
|
//@future_incompatible = FutureIncompatibleInfo {
|
||||||
// reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
// reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||||
// reference: "<FIXME>",
|
// reference: "<FIXME>",
|
||||||
|
@ -91,7 +91,7 @@ declare_lint! {
|
||||||
pub IMPL_TRAIT_REDUNDANT_CAPTURES,
|
pub IMPL_TRAIT_REDUNDANT_CAPTURES,
|
||||||
Warn,
|
Warn,
|
||||||
"redundant precise-capturing `use<...>` syntax on an `impl Trait`",
|
"redundant precise-capturing `use<...>` syntax on an `impl Trait`",
|
||||||
@feature_gate = sym::precise_capturing;
|
@feature_gate = precise_capturing;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint_pass!(
|
declare_lint_pass!(
|
||||||
|
|
|
@ -2,7 +2,6 @@ use crate::{LateContext, LateLintPass, LintContext};
|
||||||
|
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_session::{declare_lint, declare_lint_pass};
|
use rustc_session::{declare_lint, declare_lint_pass};
|
||||||
use rustc_span::sym;
|
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
/// The `multiple_supertrait_upcastable` lint detects when an object-safe trait has multiple
|
/// The `multiple_supertrait_upcastable` lint detects when an object-safe trait has multiple
|
||||||
|
@ -30,7 +29,7 @@ declare_lint! {
|
||||||
pub MULTIPLE_SUPERTRAIT_UPCASTABLE,
|
pub MULTIPLE_SUPERTRAIT_UPCASTABLE,
|
||||||
Allow,
|
Allow,
|
||||||
"detect when an object-safe trait has multiple supertraits",
|
"detect when an object-safe trait has multiple supertraits",
|
||||||
@feature_gate = sym::multiple_supertrait_upcastable;
|
@feature_gate = multiple_supertrait_upcastable;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTABLE]);
|
declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTABLE]);
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
|
use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
|
||||||
use rustc_span::edition::Edition;
|
use rustc_span::edition::Edition;
|
||||||
use rustc_span::symbol::sym;
|
|
||||||
|
|
||||||
declare_lint_pass! {
|
declare_lint_pass! {
|
||||||
/// Does nothing as a lint pass, but registers some `Lint`s
|
/// Does nothing as a lint pass, but registers some `Lint`s
|
||||||
|
@ -461,7 +460,7 @@ declare_lint! {
|
||||||
pub MUST_NOT_SUSPEND,
|
pub MUST_NOT_SUSPEND,
|
||||||
Allow,
|
Allow,
|
||||||
"use of a `#[must_not_suspend]` value across a yield point",
|
"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! {
|
declare_lint! {
|
||||||
|
@ -1645,7 +1644,7 @@ declare_lint! {
|
||||||
pub RUST_2024_INCOMPATIBLE_PAT,
|
pub RUST_2024_INCOMPATIBLE_PAT,
|
||||||
Allow,
|
Allow,
|
||||||
"detects patterns whose meaning will change in Rust 2024",
|
"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
|
// FIXME uncomment below upon stabilization
|
||||||
/*@future_incompatible = FutureIncompatibleInfo {
|
/*@future_incompatible = FutureIncompatibleInfo {
|
||||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||||
|
@ -2693,7 +2692,7 @@ declare_lint! {
|
||||||
pub FUZZY_PROVENANCE_CASTS,
|
pub FUZZY_PROVENANCE_CASTS,
|
||||||
Allow,
|
Allow,
|
||||||
"a fuzzy integer to pointer cast is used",
|
"a fuzzy integer to pointer cast is used",
|
||||||
@feature_gate = sym::strict_provenance;
|
@feature_gate = strict_provenance;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
|
@ -2739,7 +2738,7 @@ declare_lint! {
|
||||||
pub LOSSY_PROVENANCE_CASTS,
|
pub LOSSY_PROVENANCE_CASTS,
|
||||||
Allow,
|
Allow,
|
||||||
"a lossy pointer to integer cast is used",
|
"a lossy pointer to integer cast is used",
|
||||||
@feature_gate = sym::strict_provenance;
|
@feature_gate = strict_provenance;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
|
@ -3923,7 +3922,7 @@ declare_lint! {
|
||||||
pub NON_EXHAUSTIVE_OMITTED_PATTERNS,
|
pub NON_EXHAUSTIVE_OMITTED_PATTERNS,
|
||||||
Allow,
|
Allow,
|
||||||
"detect when patterns of types marked `non_exhaustive` are missed",
|
"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! {
|
declare_lint! {
|
||||||
|
@ -4043,7 +4042,7 @@ declare_lint! {
|
||||||
pub TEST_UNSTABLE_LINT,
|
pub TEST_UNSTABLE_LINT,
|
||||||
Deny,
|
Deny,
|
||||||
"this unstable lint is only for testing",
|
"this unstable lint is only for testing",
|
||||||
@feature_gate = sym::test_unstable_lint;
|
@feature_gate = test_unstable_lint;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
|
|
|
@ -865,7 +865,7 @@ macro_rules! declare_lint {
|
||||||
);
|
);
|
||||||
);
|
);
|
||||||
($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
|
($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
|
||||||
$(@feature_gate = $gate:expr;)?
|
$(@feature_gate = $gate:ident;)?
|
||||||
$(@future_incompatible = FutureIncompatibleInfo {
|
$(@future_incompatible = FutureIncompatibleInfo {
|
||||||
reason: $reason:expr,
|
reason: $reason:expr,
|
||||||
$($field:ident : $val:expr),* $(,)*
|
$($field:ident : $val:expr),* $(,)*
|
||||||
|
@ -879,7 +879,7 @@ macro_rules! declare_lint {
|
||||||
desc: $desc,
|
desc: $desc,
|
||||||
is_externally_loaded: false,
|
is_externally_loaded: false,
|
||||||
$($v: true,)*
|
$($v: true,)*
|
||||||
$(feature_gate: Some($gate),)?
|
$(feature_gate: Some(rustc_span::symbol::sym::$gate),)?
|
||||||
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
|
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
|
||||||
reason: $reason,
|
reason: $reason,
|
||||||
$($field: $val,)*
|
$($field: $val,)*
|
||||||
|
@ -895,21 +895,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;)?
|
$(, @feature_gate = $gate:ident;)?
|
||||||
) => (
|
) => (
|
||||||
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false $(, @feature_gate = $gate;)?}
|
$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;)?
|
$(, @feature_gate = $gate:ident;)?
|
||||||
) => (
|
) => (
|
||||||
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep $(, @feature_gate = $gate;)?}
|
$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;)?
|
$(, @feature_gate = $gate:ident;)?
|
||||||
) => (
|
) => (
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
$vis static $NAME: &$crate::Lint = &$crate::Lint {
|
$vis static $NAME: &$crate::Lint = &$crate::Lint {
|
||||||
|
@ -920,7 +920,7 @@ macro_rules! declare_tool_lint {
|
||||||
report_in_external_macro: $external,
|
report_in_external_macro: $external,
|
||||||
future_incompatible: None,
|
future_incompatible: None,
|
||||||
is_externally_loaded: true,
|
is_externally_loaded: true,
|
||||||
$(feature_gate: Some($gate),)?
|
$(feature_gate: Some(rustc_span::symbol::sym::$gate),)?
|
||||||
crate_level_only: false,
|
crate_level_only: false,
|
||||||
..$crate::Lint::default_fields_for_macro()
|
..$crate::Lint::default_fields_for_macro()
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,7 +66,7 @@ where
|
||||||
macro_rules! declare_rustdoc_lint {
|
macro_rules! declare_rustdoc_lint {
|
||||||
(
|
(
|
||||||
$(#[$attr:meta])* $name: ident, $level: ident, $descr: literal $(,)?
|
$(#[$attr:meta])* $name: ident, $level: ident, $descr: literal $(,)?
|
||||||
$(@feature_gate = $gate:expr;)?
|
$(@feature_gate = $gate:ident;)?
|
||||||
) => {
|
) => {
|
||||||
declare_tool_lint! {
|
declare_tool_lint! {
|
||||||
$(#[$attr])* pub rustdoc::$name, $level, $descr
|
$(#[$attr])* pub rustdoc::$name, $level, $descr
|
||||||
|
@ -128,7 +128,7 @@ declare_rustdoc_lint! {
|
||||||
MISSING_DOC_CODE_EXAMPLES,
|
MISSING_DOC_CODE_EXAMPLES,
|
||||||
Allow,
|
Allow,
|
||||||
"detects publicly-exported items without code samples in their documentation",
|
"detects publicly-exported items without code samples in their documentation",
|
||||||
@feature_gate = rustc_span::symbol::sym::rustdoc_missing_doc_code_examples;
|
@feature_gate = rustdoc_missing_doc_code_examples;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_rustdoc_lint! {
|
declare_rustdoc_lint! {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue