mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
lints_that_dont_need_to_run: never skip future-compat-reported lints
This commit is contained in:
parent
46e8d20301
commit
df94818366
@ -123,8 +123,13 @@ fn lints_that_dont_need_to_run(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LintId> {
|
|||||||
let dont_need_to_run: FxIndexSet<LintId> = store
|
let dont_need_to_run: FxIndexSet<LintId> = store
|
||||||
.get_lints()
|
.get_lints()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.filter(|lint| {
|
||||||
|
// Lints that show up in future-compat reports must always be run.
|
||||||
|
let has_future_breakage =
|
||||||
|
lint.future_incompatible.is_some_and(|fut| fut.reason.has_future_breakage());
|
||||||
|
!has_future_breakage && !lint.eval_always
|
||||||
|
})
|
||||||
.filter_map(|lint| {
|
.filter_map(|lint| {
|
||||||
if !lint.eval_always {
|
|
||||||
let lint_level = map.lint_level_id_at_node(tcx, LintId::of(lint), CRATE_HIR_ID);
|
let lint_level = map.lint_level_id_at_node(tcx, LintId::of(lint), CRATE_HIR_ID);
|
||||||
if matches!(lint_level, (Level::Allow, ..))
|
if matches!(lint_level, (Level::Allow, ..))
|
||||||
|| (matches!(lint_level, (.., LintLevelSource::Default)))
|
|| (matches!(lint_level, (.., LintLevelSource::Default)))
|
||||||
@ -134,9 +139,6 @@ fn lints_that_dont_need_to_run(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LintId> {
|
|||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
@ -466,6 +466,20 @@ impl FutureIncompatibilityReason {
|
|||||||
| FutureIncompatibilityReason::Custom(_) => None,
|
| FutureIncompatibilityReason::Custom(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn has_future_breakage(self) -> bool {
|
||||||
|
match self {
|
||||||
|
FutureIncompatibilityReason::FutureReleaseErrorReportInDeps => true,
|
||||||
|
|
||||||
|
FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps
|
||||||
|
| FutureIncompatibilityReason::FutureReleaseSemanticsChange
|
||||||
|
| FutureIncompatibilityReason::EditionError(_)
|
||||||
|
| FutureIncompatibilityReason::EditionSemanticsChange(_)
|
||||||
|
| FutureIncompatibilityReason::EditionAndFutureReleaseError(_)
|
||||||
|
| FutureIncompatibilityReason::EditionAndFutureReleaseSemanticsChange(_)
|
||||||
|
| FutureIncompatibilityReason::Custom(_) => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FutureIncompatibleInfo {
|
impl FutureIncompatibleInfo {
|
||||||
|
@ -290,12 +290,7 @@ pub fn lint_level(
|
|||||||
let has_future_breakage = future_incompatible.map_or(
|
let has_future_breakage = future_incompatible.map_or(
|
||||||
// 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| incompat.reason.has_future_breakage(),
|
||||||
matches!(
|
|
||||||
incompat.reason,
|
|
||||||
FutureIncompatibilityReason::FutureReleaseErrorReportInDeps
|
|
||||||
)
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Convert lint level to error level.
|
// Convert lint level to error level.
|
||||||
|
Loading…
Reference in New Issue
Block a user