diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs index d0967ba5644..814991cd8c9 100644 --- a/compiler/rustc_lint/src/array_into_iter.rs +++ b/compiler/rustc_lint/src/array_into_iter.rs @@ -34,8 +34,8 @@ declare_lint! { Warn, "detects calling `into_iter` on arrays in Rust 2015 and 2018", @future_incompatible = FutureIncompatibleInfo { - reference: "", reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021), + reference: "", }; } diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index d38c6b2642a..4f6b79d9aee 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -844,8 +844,8 @@ declare_lint! { Warn, "detects anonymous parameters", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #41686 ", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018), + reference: "issue #41686 ", }; } @@ -1669,8 +1669,8 @@ declare_lint! { Warn, "`...` range patterns are deprecated", @future_incompatible = FutureIncompatibleInfo { - reference: "", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), + reference: "", }; } @@ -1804,8 +1804,8 @@ declare_lint! { Allow, "detects edition keywords being used as an identifier", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #49716 ", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018), + reference: "issue #49716 ", }; } diff --git a/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs b/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs index 851c6493daf..9be2edf8453 100644 --- a/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs +++ b/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs @@ -5,6 +5,7 @@ use crate::{ use rustc_hir as hir; use rustc_middle::{traits::util::supertraits, ty}; +use rustc_session::lint::FutureIncompatibilityReason; use rustc_span::sym; declare_lint! { @@ -48,6 +49,7 @@ declare_lint! { Warn, "`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #89460 ", }; } diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index f71d49572d3..1951db49e91 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -39,6 +39,7 @@ declare_lint! { Warn, "applying forbid to lint-groups", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #81670 ", }; } @@ -74,6 +75,7 @@ declare_lint! { Deny, "ill-formed attribute inputs that were previously accepted and used in practice", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #57571 ", }; crate_level_only @@ -110,6 +112,7 @@ declare_lint! { Deny, "conflicts between `#[repr(..)]` hints that were previously accepted and used in practice", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #68585 ", }; } @@ -1016,8 +1019,8 @@ declare_lint! { Deny, "raw pointers must be aligned before dereferencing", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #68585 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #68585 ", }; } @@ -1096,6 +1099,7 @@ declare_lint! { Deny, "detect public re-exports of private extern crates", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #34537 ", }; } @@ -1125,6 +1129,7 @@ declare_lint! { Deny, "type parameter default erroneously allowed in invalid location", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #36887 ", }; } @@ -1267,6 +1272,7 @@ declare_lint! { Deny, "patterns in functions without body were erroneously allowed", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #35203 ", }; } @@ -1310,6 +1316,7 @@ declare_lint! { Deny, "detects missing fragment specifiers in unused `macro_rules!` patterns", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #40107 ", }; } @@ -1351,6 +1358,7 @@ declare_lint! { Warn, "detects generic lifetime arguments in path segments with late bound lifetime parameters", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #42868 ", }; } @@ -1386,8 +1394,8 @@ declare_lint! { Deny, "trait-object types were treated as different depending on marker-trait order", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #56484 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #56484 ", }; } @@ -1426,6 +1434,7 @@ declare_lint! { Warn, "distinct impls distinguished only by the leak-check code", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #56105 ", }; } @@ -1617,8 +1626,8 @@ declare_lint! { Warn, "raw pointer to an inference variable", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #46906 ", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018), + reference: "issue #46906 ", }; } @@ -1685,8 +1694,8 @@ declare_lint! { Warn, "suggest using `dyn Trait` for trait objects", @future_incompatible = FutureIncompatibleInfo { - reference: "", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), + reference: "", }; } @@ -1740,8 +1749,8 @@ declare_lint! { "fully qualified paths that start with a module name \ instead of `crate`, `self`, or an extern crate name", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #53130 ", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018), + reference: "issue #53130 ", }; } @@ -1789,6 +1798,7 @@ declare_lint! { Warn, "floating-point literals cannot be used in patterns", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #41620 ", }; } @@ -1939,6 +1949,7 @@ declare_lint! { Warn, "checks the object safety of where clauses", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #51443 ", }; } @@ -2005,8 +2016,8 @@ declare_lint! { Deny, "detects proc macro derives using inaccessible names from parent modules", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #83583 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #83583 ", }; } @@ -2108,6 +2119,7 @@ declare_lint! { "macro-expanded `macro_export` macros from the current crate \ cannot be referred to by absolute paths", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #52234 ", }; crate_level_only @@ -2199,6 +2211,7 @@ declare_lint! { Warn, "constant used in pattern contains value of non-structural-match type in a field or a variant", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #62411 ", }; } @@ -2253,6 +2266,7 @@ declare_lint! { Allow, "pointers are not structural-match", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #62411 ", }; } @@ -2291,6 +2305,7 @@ declare_lint! { "constant used in pattern of non-structural-match type and the constant's initializer \ expression contains values of non-structural-match types", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #73448 ", }; } @@ -2348,6 +2363,7 @@ declare_lint! { Deny, "ambiguous associated items", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #57644 ", }; } @@ -2389,6 +2405,7 @@ declare_lint! { Deny, "a feature gate that doesn't break dependent crates", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #64266 ", }; } @@ -2617,8 +2634,8 @@ declare_lint! { Deny, "a C-like enum implementing Drop is cast", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #73333 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #73333 ", }; } @@ -2747,6 +2764,7 @@ declare_lint! { Warn, "detects a generic constant is used in a type without a emitting a warning", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #76200 ", }; } @@ -2805,6 +2823,7 @@ declare_lint! { Warn, "uninhabited static", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #74840 ", }; } @@ -2975,8 +2994,8 @@ declare_lint! { Warn, "trailing semicolon in macro body used as expression", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #79813 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #79813 ", }; } @@ -3022,6 +3041,7 @@ declare_lint! { Warn, "detects derive helper attributes that are used before they are introduced", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #79202 ", }; } @@ -3090,6 +3110,7 @@ declare_lint! { Deny, "detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #91632 ", }; } @@ -3181,6 +3202,7 @@ declare_lint! { Warn, "transparent type contains an external ZST that is marked #[non_exhaustive] or contains private fields", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #78586 ", }; } @@ -3231,6 +3253,7 @@ declare_lint! { Warn, "unstable syntax can change at any point in the future, causing a hard error!", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #65860 ", }; } @@ -3662,6 +3685,7 @@ declare_lint! { Warn, "detects invalid `#[doc(...)]` attributes", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #82730 ", }; } @@ -3708,8 +3732,8 @@ declare_lint! { Deny, "detects usage of old versions of certain proc-macro crates", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #83125 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #83125 ", }; } @@ -3747,8 +3771,8 @@ declare_lint! { Allow, "detects usage of old versions of or-patterns", @future_incompatible = FutureIncompatibleInfo { - reference: "", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), + reference: "", }; } @@ -3796,8 +3820,8 @@ declare_lint! { "detects the usage of trait methods which are ambiguous with traits added to the \ prelude in future editions", @future_incompatible = FutureIncompatibleInfo { - reference: "", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), + reference: "", }; } @@ -3833,8 +3857,8 @@ declare_lint! { Allow, "identifiers that will be parsed as a prefix in Rust 2021", @future_incompatible = FutureIncompatibleInfo { - reference: "", reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), + reference: "", }; crate_level_only } @@ -3881,6 +3905,7 @@ declare_lint! { Warn, "use of unsupported calling convention", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #87678 ", }; } @@ -4221,8 +4246,8 @@ declare_lint! { Deny, "impl method assumes more implied bounds than its corresponding trait method", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #105572 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #105572 ", }; } @@ -4253,8 +4278,8 @@ declare_lint! { Warn, "`[u8]` or `str` used in a packed struct with `derive`", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #107457 ", reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #107457 ", }; report_in_external_macro } @@ -4415,6 +4440,7 @@ declare_lint! { "impls that are not considered to overlap may be considered to \ overlap in the future", @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, reference: "issue #114040 ", }; } diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index aced50ca510..84e7ecb0b88 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -724,7 +724,10 @@ macro_rules! declare_lint { ); ($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr, $(@feature_gate = $gate:expr;)? - $(@future_incompatible = FutureIncompatibleInfo { $($field:ident : $val:expr),* $(,)* }; )? + $(@future_incompatible = FutureIncompatibleInfo { + reason: $reason:expr, + $($field:ident : $val:expr),* $(,)* + }; )? $(@edition $lint_edition:ident => $edition_level:ident;)? $($v:ident),*) => ( $(#[$attr])* @@ -736,6 +739,7 @@ macro_rules! declare_lint { $($v: true,)* $(feature_gate: Some($gate),)? $(future_incompatible: Some($crate::FutureIncompatibleInfo { + reason: $reason, $($field: $val,)* ..$crate::FutureIncompatibleInfo::default_fields_for_macro() }),)?