Skip to content

Commit 1a18ec0

Browse files
authored
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.
2 parents 66f272d + 7abbb9a commit 1a18ec0

File tree

9 files changed

+79
-32
lines changed

9 files changed

+79
-32
lines changed

compiler/rustc_errors/src/diagnostic.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ impl fmt::Display for DiagnosticLocation {
151151
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
152152
pub enum DiagnosticId {
153153
Error(String),
154-
Lint { name: String, has_future_breakage: bool, is_force_warn: bool },
154+
Lint {
155+
name: String,
156+
/// Indicates whether this lint should show up in cargo's future breakage report.
157+
has_future_breakage: bool,
158+
is_force_warn: bool,
159+
},
155160
}
156161

157162
/// A "sub"-diagnostic attached to a parent diagnostic.
@@ -301,6 +306,7 @@ impl Diagnostic {
301306
}
302307
}
303308

309+
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
304310
pub fn has_future_breakage(&self) -> bool {
305311
match self.code {
306312
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,

compiler/rustc_lint/src/array_into_iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ declare_lint! {
3434
Warn,
3535
"detects calling `into_iter` on arrays in Rust 2015 and 2018",
3636
@future_incompatible = FutureIncompatibleInfo {
37-
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
3837
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
38+
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
3939
};
4040
}
4141

compiler/rustc_lint/src/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,8 @@ declare_lint! {
844844
Warn,
845845
"detects anonymous parameters",
846846
@future_incompatible = FutureIncompatibleInfo {
847-
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
848847
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
848+
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
849849
};
850850
}
851851

@@ -1669,8 +1669,8 @@ declare_lint! {
16691669
Warn,
16701670
"`...` range patterns are deprecated",
16711671
@future_incompatible = FutureIncompatibleInfo {
1672-
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
16731672
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
1673+
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
16741674
};
16751675
}
16761676

@@ -1804,8 +1804,8 @@ declare_lint! {
18041804
Allow,
18051805
"detects edition keywords being used as an identifier",
18061806
@future_incompatible = FutureIncompatibleInfo {
1807-
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
18081807
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
1808+
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
18091809
};
18101810
}
18111811

compiler/rustc_lint/src/deref_into_dyn_supertrait.rs

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::{
55

66
use rustc_hir as hir;
77
use rustc_middle::{traits::util::supertraits, ty};
8+
use rustc_session::lint::FutureIncompatibilityReason;
89
use rustc_span::sym;
910

1011
declare_lint! {
@@ -48,6 +49,7 @@ declare_lint! {
4849
Warn,
4950
"`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future",
5051
@future_incompatible = FutureIncompatibleInfo {
52+
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
5153
reference: "issue #89460 <https://github.com/rust-lang/rust/issues/89460>",
5254
};
5355
}

0 commit comments

Comments
 (0)