Skip to content

Commit 6f3ad0a

Browse files
Only require symbol name for @feature_gate
1 parent e9e6e2e commit 6f3ad0a

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

compiler/rustc_lint/src/impl_trait_overcaptures.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::ty::{
1111
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
1212
};
1313
use rustc_session::{declare_lint, declare_lint_pass};
14-
use rustc_span::{sym, Span};
14+
use rustc_span::Span;
1515

1616
use crate::fluent_generated as fluent;
1717
use crate::{LateContext, LateLintPass};
@@ -57,7 +57,7 @@ declare_lint! {
5757
pub IMPL_TRAIT_OVERCAPTURES,
5858
Allow,
5959
"`impl Trait` will capture more lifetimes than possibly intended in edition 2024",
60-
@feature_gate = sym::precise_capturing;
60+
@feature_gate = precise_capturing;
6161
//@future_incompatible = FutureIncompatibleInfo {
6262
// reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
6363
// reference: "<FIXME>",
@@ -91,7 +91,7 @@ declare_lint! {
9191
pub IMPL_TRAIT_REDUNDANT_CAPTURES,
9292
Warn,
9393
"redundant precise-capturing `use<...>` syntax on an `impl Trait`",
94-
@feature_gate = sym::precise_capturing;
94+
@feature_gate = precise_capturing;
9595
}
9696

9797
declare_lint_pass!(

compiler/rustc_lint/src/multiple_supertrait_upcastable.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::{LateContext, LateLintPass, LintContext};
22

33
use rustc_hir as hir;
44
use rustc_session::{declare_lint, declare_lint_pass};
5-
use rustc_span::sym;
65

76
declare_lint! {
87
/// The `multiple_supertrait_upcastable` lint detects when an object-safe trait has multiple
@@ -30,7 +29,7 @@ declare_lint! {
3029
pub MULTIPLE_SUPERTRAIT_UPCASTABLE,
3130
Allow,
3231
"detect when an object-safe trait has multiple supertraits",
33-
@feature_gate = sym::multiple_supertrait_upcastable;
32+
@feature_gate = multiple_supertrait_upcastable;
3433
}
3534

3635
declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTABLE]);

compiler/rustc_lint_defs/src/builtin.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
1010
use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
1111
use rustc_span::edition::Edition;
12-
use rustc_span::symbol::sym;
1312

1413
declare_lint_pass! {
1514
/// Does nothing as a lint pass, but registers some `Lint`s
@@ -461,7 +460,7 @@ declare_lint! {
461460
pub MUST_NOT_SUSPEND,
462461
Allow,
463462
"use of a `#[must_not_suspend]` value across a yield point",
464-
@feature_gate = rustc_span::symbol::sym::must_not_suspend;
463+
@feature_gate = must_not_suspend;
465464
}
466465

467466
declare_lint! {
@@ -1645,7 +1644,7 @@ declare_lint! {
16451644
pub RUST_2024_INCOMPATIBLE_PAT,
16461645
Allow,
16471646
"detects patterns whose meaning will change in Rust 2024",
1648-
@feature_gate = sym::ref_pat_eat_one_layer_2024;
1647+
@feature_gate = ref_pat_eat_one_layer_2024;
16491648
// FIXME uncomment below upon stabilization
16501649
/*@future_incompatible = FutureIncompatibleInfo {
16511650
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
@@ -2693,7 +2692,7 @@ declare_lint! {
26932692
pub FUZZY_PROVENANCE_CASTS,
26942693
Allow,
26952694
"a fuzzy integer to pointer cast is used",
2696-
@feature_gate = sym::strict_provenance;
2695+
@feature_gate = strict_provenance;
26972696
}
26982697

26992698
declare_lint! {
@@ -2739,7 +2738,7 @@ declare_lint! {
27392738
pub LOSSY_PROVENANCE_CASTS,
27402739
Allow,
27412740
"a lossy pointer to integer cast is used",
2742-
@feature_gate = sym::strict_provenance;
2741+
@feature_gate = strict_provenance;
27432742
}
27442743

27452744
declare_lint! {
@@ -3923,7 +3922,7 @@ declare_lint! {
39233922
pub NON_EXHAUSTIVE_OMITTED_PATTERNS,
39243923
Allow,
39253924
"detect when patterns of types marked `non_exhaustive` are missed",
3926-
@feature_gate = sym::non_exhaustive_omitted_patterns_lint;
3925+
@feature_gate = non_exhaustive_omitted_patterns_lint;
39273926
}
39283927

39293928
declare_lint! {
@@ -4043,7 +4042,7 @@ declare_lint! {
40434042
pub TEST_UNSTABLE_LINT,
40444043
Deny,
40454044
"this unstable lint is only for testing",
4046-
@feature_gate = sym::test_unstable_lint;
4045+
@feature_gate = test_unstable_lint;
40474046
}
40484047

40494048
declare_lint! {

compiler/rustc_lint_defs/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ macro_rules! declare_lint {
865865
);
866866
);
867867
($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
868-
$(@feature_gate = $gate:expr;)?
868+
$(@feature_gate = $gate:ident;)?
869869
$(@future_incompatible = FutureIncompatibleInfo {
870870
reason: $reason:expr,
871871
$($field:ident : $val:expr),* $(,)*
@@ -879,7 +879,7 @@ macro_rules! declare_lint {
879879
desc: $desc,
880880
is_externally_loaded: false,
881881
$($v: true,)*
882-
$(feature_gate: Some($gate),)?
882+
$(feature_gate: Some(rustc_span::symbol::sym::$gate),)?
883883
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
884884
reason: $reason,
885885
$($field: $val,)*
@@ -895,21 +895,21 @@ macro_rules! declare_lint {
895895
macro_rules! declare_tool_lint {
896896
(
897897
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr
898-
$(, @feature_gate = $gate:expr;)?
898+
$(, @feature_gate = $gate:ident;)?
899899
) => (
900900
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false $(, @feature_gate = $gate;)?}
901901
);
902902
(
903903
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
904904
report_in_external_macro: $rep:expr
905-
$(, @feature_gate = $gate:expr;)?
905+
$(, @feature_gate = $gate:ident;)?
906906
) => (
907907
$crate::declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep $(, @feature_gate = $gate;)?}
908908
);
909909
(
910910
$(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr,
911911
$external:expr
912-
$(, @feature_gate = $gate:expr;)?
912+
$(, @feature_gate = $gate:ident;)?
913913
) => (
914914
$(#[$attr])*
915915
$vis static $NAME: &$crate::Lint = &$crate::Lint {
@@ -920,7 +920,7 @@ macro_rules! declare_tool_lint {
920920
report_in_external_macro: $external,
921921
future_incompatible: None,
922922
is_externally_loaded: true,
923-
$(feature_gate: Some($gate),)?
923+
$(feature_gate: Some(rustc_span::symbol::sym::$gate),)?
924924
crate_level_only: false,
925925
..$crate::Lint::default_fields_for_macro()
926926
};

src/librustdoc/lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ where
6666
macro_rules! declare_rustdoc_lint {
6767
(
6868
$(#[$attr:meta])* $name: ident, $level: ident, $descr: literal $(,)?
69-
$(@feature_gate = $gate:expr;)?
69+
$(@feature_gate = $gate:ident;)?
7070
) => {
7171
declare_tool_lint! {
7272
$(#[$attr])* pub rustdoc::$name, $level, $descr
@@ -128,7 +128,7 @@ declare_rustdoc_lint! {
128128
MISSING_DOC_CODE_EXAMPLES,
129129
Allow,
130130
"detects publicly-exported items without code samples in their documentation",
131-
@feature_gate = rustc_span::symbol::sym::rustdoc_missing_doc_code_examples;
131+
@feature_gate = rustdoc_missing_doc_code_examples;
132132
}
133133

134134
declare_rustdoc_lint! {

0 commit comments

Comments
 (0)