Rollup merge of #116049 - RalfJung:future-incompat, r=Nilstrieb
give FutureIncompatibilityReason variants more explicit names Also make the `reason` field mandatory when declaring a lint, to make sure this is a deliberate decision.
This commit is contained in:
commit
1a18ec0dcf
@ -151,7 +151,12 @@ impl fmt::Display for DiagnosticLocation {
|
|||||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
|
||||||
pub enum DiagnosticId {
|
pub enum DiagnosticId {
|
||||||
Error(String),
|
Error(String),
|
||||||
Lint { name: String, has_future_breakage: bool, is_force_warn: bool },
|
Lint {
|
||||||
|
name: String,
|
||||||
|
/// Indicates whether this lint should show up in cargo's future breakage report.
|
||||||
|
has_future_breakage: bool,
|
||||||
|
is_force_warn: bool,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A "sub"-diagnostic attached to a parent diagnostic.
|
/// A "sub"-diagnostic attached to a parent diagnostic.
|
||||||
@ -301,6 +306,7 @@ impl Diagnostic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
|
||||||
pub fn has_future_breakage(&self) -> bool {
|
pub fn has_future_breakage(&self) -> bool {
|
||||||
match self.code {
|
match self.code {
|
||||||
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
|
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
|
||||||
|
@ -34,8 +34,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects calling `into_iter` on arrays in Rust 2015 and 2018",
|
"detects calling `into_iter` on arrays in Rust 2015 and 2018",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
|
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
|
||||||
|
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,8 +844,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects anonymous parameters",
|
"detects anonymous parameters",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||||
|
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1669,8 +1669,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"`...` range patterns are deprecated",
|
"`...` range patterns are deprecated",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||||
|
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1804,8 +1804,8 @@ declare_lint! {
|
|||||||
Allow,
|
Allow,
|
||||||
"detects edition keywords being used as an identifier",
|
"detects edition keywords being used as an identifier",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||||
|
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ use crate::{
|
|||||||
|
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_middle::{traits::util::supertraits, ty};
|
use rustc_middle::{traits::util::supertraits, ty};
|
||||||
|
use rustc_session::lint::FutureIncompatibilityReason;
|
||||||
use rustc_span::sym;
|
use rustc_span::sym;
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
@ -48,6 +49,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future",
|
"`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #89460 <https://github.com/rust-lang/rust/issues/89460>",
|
reference: "issue #89460 <https://github.com/rust-lang/rust/issues/89460>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"applying forbid to lint-groups",
|
"applying forbid to lint-groups",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
|
reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -74,6 +75,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"ill-formed attribute inputs that were previously accepted and used in practice",
|
"ill-formed attribute inputs that were previously accepted and used in practice",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||||
};
|
};
|
||||||
crate_level_only
|
crate_level_only
|
||||||
@ -110,6 +112,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice",
|
"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/68585>",
|
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/68585>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1016,8 +1019,8 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"raw pointers must be aligned before dereferencing",
|
"raw pointers must be aligned before dereferencing",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
|
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1096,6 +1099,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"detect public re-exports of private extern crates",
|
"detect public re-exports of private extern crates",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1125,6 +1129,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"type parameter default erroneously allowed in invalid location",
|
"type parameter default erroneously allowed in invalid location",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
|
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1267,6 +1272,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"patterns in functions without body were erroneously allowed",
|
"patterns in functions without body were erroneously allowed",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1310,6 +1316,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"detects missing fragment specifiers in unused `macro_rules!` patterns",
|
"detects missing fragment specifiers in unused `macro_rules!` patterns",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
|
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1351,6 +1358,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects generic lifetime arguments in path segments with late bound lifetime parameters",
|
"detects generic lifetime arguments in path segments with late bound lifetime parameters",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
|
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1386,8 +1394,8 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"trait-object types were treated as different depending on marker-trait order",
|
"trait-object types were treated as different depending on marker-trait order",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,6 +1434,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"distinct impls distinguished only by the leak-check code",
|
"distinct impls distinguished only by the leak-check code",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
|
reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1617,8 +1626,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"raw pointer to an inference variable",
|
"raw pointer to an inference variable",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||||
|
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1685,8 +1694,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"suggest using `dyn Trait` for trait objects",
|
"suggest using `dyn Trait` for trait objects",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||||
|
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1740,8 +1749,8 @@ declare_lint! {
|
|||||||
"fully qualified paths that start with a module name \
|
"fully qualified paths that start with a module name \
|
||||||
instead of `crate`, `self`, or an extern crate name",
|
instead of `crate`, `self`, or an extern crate name",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||||
|
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1789,6 +1798,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"floating-point literals cannot be used in patterns",
|
"floating-point literals cannot be used in patterns",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
|
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1939,6 +1949,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"checks the object safety of where clauses",
|
"checks the object safety of where clauses",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
|
reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2005,8 +2016,8 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"detects proc macro derives using inaccessible names from parent modules",
|
"detects proc macro derives using inaccessible names from parent modules",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
|
reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2108,6 +2119,7 @@ declare_lint! {
|
|||||||
"macro-expanded `macro_export` macros from the current crate \
|
"macro-expanded `macro_export` macros from the current crate \
|
||||||
cannot be referred to by absolute paths",
|
cannot be referred to by absolute paths",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
|
reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
|
||||||
};
|
};
|
||||||
crate_level_only
|
crate_level_only
|
||||||
@ -2199,6 +2211,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"constant used in pattern contains value of non-structural-match type in a field or a variant",
|
"constant used in pattern contains value of non-structural-match type in a field or a variant",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
|
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2253,6 +2266,7 @@ declare_lint! {
|
|||||||
Allow,
|
Allow,
|
||||||
"pointers are not structural-match",
|
"pointers are not structural-match",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
|
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2291,6 +2305,7 @@ declare_lint! {
|
|||||||
"constant used in pattern of non-structural-match type and the constant's initializer \
|
"constant used in pattern of non-structural-match type and the constant's initializer \
|
||||||
expression contains values of non-structural-match types",
|
expression contains values of non-structural-match types",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #73448 <https://github.com/rust-lang/rust/issues/73448>",
|
reference: "issue #73448 <https://github.com/rust-lang/rust/issues/73448>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2348,6 +2363,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"ambiguous associated items",
|
"ambiguous associated items",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
|
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2389,6 +2405,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"a feature gate that doesn't break dependent crates",
|
"a feature gate that doesn't break dependent crates",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
|
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2617,8 +2634,8 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"a C-like enum implementing Drop is cast",
|
"a C-like enum implementing Drop is cast",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
|
reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2747,6 +2764,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects a generic constant is used in a type without a emitting a warning",
|
"detects a generic constant is used in a type without a emitting a warning",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>",
|
reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2805,6 +2823,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"uninhabited static",
|
"uninhabited static",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #74840 <https://github.com/rust-lang/rust/issues/74840>",
|
reference: "issue #74840 <https://github.com/rust-lang/rust/issues/74840>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2975,8 +2994,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"trailing semicolon in macro body used as expression",
|
"trailing semicolon in macro body used as expression",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
|
reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3022,6 +3041,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects derive helper attributes that are used before they are introduced",
|
"detects derive helper attributes that are used before they are introduced",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #79202 <https://github.com/rust-lang/rust/issues/79202>",
|
reference: "issue #79202 <https://github.com/rust-lang/rust/issues/79202>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -3090,6 +3110,7 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
|
"detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",
|
reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -3181,6 +3202,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"transparent type contains an external ZST that is marked #[non_exhaustive] or contains private fields",
|
"transparent type contains an external ZST that is marked #[non_exhaustive] or contains private fields",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #78586 <https://github.com/rust-lang/rust/issues/78586>",
|
reference: "issue #78586 <https://github.com/rust-lang/rust/issues/78586>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -3231,6 +3253,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"unstable syntax can change at any point in the future, causing a hard error!",
|
"unstable syntax can change at any point in the future, causing a hard error!",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #65860 <https://github.com/rust-lang/rust/issues/65860>",
|
reference: "issue #65860 <https://github.com/rust-lang/rust/issues/65860>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -3662,6 +3685,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects invalid `#[doc(...)]` attributes",
|
"detects invalid `#[doc(...)]` attributes",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #82730 <https://github.com/rust-lang/rust/issues/82730>",
|
reference: "issue #82730 <https://github.com/rust-lang/rust/issues/82730>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -3708,8 +3732,8 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"detects usage of old versions of certain proc-macro crates",
|
"detects usage of old versions of certain proc-macro crates",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",
|
reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3747,8 +3771,8 @@ declare_lint! {
|
|||||||
Allow,
|
Allow,
|
||||||
"detects usage of old versions of or-patterns",
|
"detects usage of old versions of or-patterns",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/or-patterns-macro-rules.html>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||||
|
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/or-patterns-macro-rules.html>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3796,8 +3820,8 @@ declare_lint! {
|
|||||||
"detects the usage of trait methods which are ambiguous with traits added to the \
|
"detects the usage of trait methods which are ambiguous with traits added to the \
|
||||||
prelude in future editions",
|
prelude in future editions",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||||
|
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3833,8 +3857,8 @@ declare_lint! {
|
|||||||
Allow,
|
Allow,
|
||||||
"identifiers that will be parsed as a prefix in Rust 2021",
|
"identifiers that will be parsed as a prefix in Rust 2021",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/reserving-syntax.html>",
|
|
||||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||||
|
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/reserving-syntax.html>",
|
||||||
};
|
};
|
||||||
crate_level_only
|
crate_level_only
|
||||||
}
|
}
|
||||||
@ -3881,6 +3905,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"use of unsupported calling convention",
|
"use of unsupported calling convention",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #87678 <https://github.com/rust-lang/rust/issues/87678>",
|
reference: "issue #87678 <https://github.com/rust-lang/rust/issues/87678>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -4221,8 +4246,8 @@ declare_lint! {
|
|||||||
Deny,
|
Deny,
|
||||||
"impl method assumes more implied bounds than its corresponding trait method",
|
"impl method assumes more implied bounds than its corresponding trait method",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
|
reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4253,8 +4278,8 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"`[u8]` or `str` used in a packed struct with `derive`",
|
"`[u8]` or `str` used in a packed struct with `derive`",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||||
reference: "issue #107457 <https://github.com/rust-lang/rust/issues/107457>",
|
reference: "issue #107457 <https://github.com/rust-lang/rust/issues/107457>",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
};
|
||||||
report_in_external_macro
|
report_in_external_macro
|
||||||
}
|
}
|
||||||
@ -4415,6 +4440,7 @@ declare_lint! {
|
|||||||
"impls that are not considered to overlap may be considered to \
|
"impls that are not considered to overlap may be considered to \
|
||||||
overlap in the future",
|
overlap in the future",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #114040 <https://github.com/rust-lang/rust/issues/114040>",
|
reference: "issue #114040 <https://github.com/rust-lang/rust/issues/114040>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -4483,7 +4509,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"detects certain glob imports that require reporting an ambiguity error",
|
"detects certain glob imports that require reporting an ambiguity error",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
|
reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -4568,7 +4594,7 @@ declare_lint! {
|
|||||||
Warn,
|
Warn,
|
||||||
"elided lifetimes cannot be used in associated constants in impls",
|
"elided lifetimes cannot be used in associated constants in impls",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
reference: "issue #115010 <https://github.com/rust-lang/rust/issues/115010>",
|
reference: "issue #115010 <https://github.com/rust-lang/rust/issues/115010>",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -347,12 +347,18 @@ pub struct FutureIncompatibleInfo {
|
|||||||
/// The reason for future incompatibility
|
/// The reason for future incompatibility
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum FutureIncompatibilityReason {
|
pub enum FutureIncompatibilityReason {
|
||||||
/// This will be an error in a future release
|
/// This will be an error in a future release for all editions
|
||||||
/// for all editions
|
///
|
||||||
FutureReleaseError,
|
/// This will *not* show up in cargo's future breakage report.
|
||||||
|
/// The warning will hence only be seen in local crates, not in dependencies.
|
||||||
|
FutureReleaseErrorDontReportInDeps,
|
||||||
/// This will be an error in a future release, and
|
/// This will be an error in a future release, and
|
||||||
/// Cargo should create a report even for dependencies
|
/// Cargo should create a report even for dependencies
|
||||||
FutureReleaseErrorReportNow,
|
///
|
||||||
|
/// This is the *only* reason that will make future incompatibility warnings show up in cargo's
|
||||||
|
/// reports. All other future incompatibility warnings are not visible when they occur in a
|
||||||
|
/// dependency.
|
||||||
|
FutureReleaseErrorReportInDeps,
|
||||||
/// Code that changes meaning in some way in a
|
/// Code that changes meaning in some way in a
|
||||||
/// future release.
|
/// future release.
|
||||||
FutureReleaseSemanticsChange,
|
FutureReleaseSemanticsChange,
|
||||||
@ -380,7 +386,7 @@ impl FutureIncompatibleInfo {
|
|||||||
pub const fn default_fields_for_macro() -> Self {
|
pub const fn default_fields_for_macro() -> Self {
|
||||||
FutureIncompatibleInfo {
|
FutureIncompatibleInfo {
|
||||||
reference: "",
|
reference: "",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||||
explain_reason: true,
|
explain_reason: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -718,7 +724,10 @@ 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: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;)?
|
$(@edition $lint_edition:ident => $edition_level:ident;)?
|
||||||
$($v:ident),*) => (
|
$($v:ident),*) => (
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
@ -730,6 +739,7 @@ macro_rules! declare_lint {
|
|||||||
$($v: true,)*
|
$($v: true,)*
|
||||||
$(feature_gate: Some($gate),)?
|
$(feature_gate: Some($gate),)?
|
||||||
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
|
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
|
||||||
|
reason: $reason,
|
||||||
$($field: $val,)*
|
$($field: $val,)*
|
||||||
..$crate::FutureIncompatibleInfo::default_fields_for_macro()
|
..$crate::FutureIncompatibleInfo::default_fields_for_macro()
|
||||||
}),)?
|
}),)?
|
||||||
|
@ -314,7 +314,10 @@ pub fn struct_lint_level(
|
|||||||
// Default allow lints trigger too often for testing.
|
// Default allow lints trigger too often for testing.
|
||||||
sess.opts.unstable_opts.future_incompat_test && lint.default_level != Level::Allow,
|
sess.opts.unstable_opts.future_incompat_test && lint.default_level != Level::Allow,
|
||||||
|incompat| {
|
|incompat| {
|
||||||
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
|
matches!(
|
||||||
|
incompat.reason,
|
||||||
|
FutureIncompatibilityReason::FutureReleaseErrorReportInDeps
|
||||||
|
)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -404,8 +407,8 @@ pub fn struct_lint_level(
|
|||||||
|
|
||||||
if let Some(future_incompatible) = future_incompatible {
|
if let Some(future_incompatible) = future_incompatible {
|
||||||
let explanation = match future_incompatible.reason {
|
let explanation = match future_incompatible.reason {
|
||||||
FutureIncompatibilityReason::FutureReleaseError
|
FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps
|
||||||
| FutureIncompatibilityReason::FutureReleaseErrorReportNow => {
|
| FutureIncompatibilityReason::FutureReleaseErrorReportInDeps => {
|
||||||
"this was previously accepted by the compiler but is being phased out; \
|
"this was previously accepted by the compiler but is being phased out; \
|
||||||
it will become a hard error in a future release!"
|
it will become a hard error in a future release!"
|
||||||
.to_owned()
|
.to_owned()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// check-fail
|
// check-fail
|
||||||
// Tests that a doc comment will not preclude a field from being considered a diagnostic argument
|
// Tests that a doc comment will not preclude a field from being considered a diagnostic argument
|
||||||
// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr"
|
// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr"
|
||||||
// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC"
|
// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC"
|
||||||
|
|
||||||
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
|
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
|
||||||
// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
|
// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
|
||||||
|
@ -23,7 +23,7 @@ LL | arg: NotIntoDiagnosticArg,
|
|||||||
|
|
|
|
||||||
= help: normalized in stderr
|
= help: normalized in stderr
|
||||||
note: required by a bound in `Diagnostic::set_arg`
|
note: required by a bound in `Diagnostic::set_arg`
|
||||||
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:968:5
|
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user