Add -Zfuture-incompat-test to assist with testing future-incompat reports.

This commit is contained in:
Eric Huss 2021-06-19 17:06:46 -07:00
parent a08f25a7ef
commit 636fcacb44
8 changed files with 36 additions and 17 deletions

View file

@ -8,7 +8,7 @@ use rustc_hir::HirId;
use rustc_index::vec::IndexVec;
use rustc_session::lint::{
builtin::{self, FORBIDDEN_LINT_GROUPS},
FutureIncompatibilityReason, FutureIncompatibleInfo, Level, Lint, LintId,
FutureIncompatibilityReason, Level, Lint, LintId,
};
use rustc_session::{DiagnosticMessageId, Session};
use rustc_span::hygiene::MacroKind;
@ -223,12 +223,12 @@ pub fn struct_lint_level<'s, 'd>(
let lint_id = LintId::of(lint);
let future_incompatible = lint.future_incompatible;
let has_future_breakage = matches!(
future_incompatible,
Some(FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
..
})
let has_future_breakage = future_incompatible.map_or(
// Default allow lints trigger too often for testing.
sess.opts.debugging_opts.future_incompat_test && lint.default_level != Level::Allow,
|incompat| {
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
},
);
let mut err = match (level, span) {