Skip to content

Commit 43f9d0a

Browse files
committed
Cancel emitting FCW lint if it is an edition fixing lint
1 parent aa4457f commit 43f9d0a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_middle/src/lint.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,13 @@ pub fn struct_lint_level<'s, 'd>(
272272
// emit shouldn't be automatically fixed by rustfix.
273273
err.allow_suggestions(false);
274274

275-
// If this is a future incompatible lint it'll become a hard error, so
276-
// we have to emit *something*. Also, if this lint occurs in the
277-
// expansion of a macro from an external crate, allow individual lints
278-
// to opt-out from being reported.
279-
if future_incompatible.is_none() && !lint.report_in_external_macro {
275+
// If this is a future incompatible that is not an edition fixing lint
276+
// it'll become a hard error, so we have to emit *something*. Also,
277+
// if this lint occurs in the expansion of a macro from an external crate,
278+
// allow individual lints to opt-out from being reported.
279+
let not_future_incompatible =
280+
future_incompatible.map(|f| f.edition.is_some()).unwrap_or(true);
281+
if not_future_incompatible && !lint.report_in_external_macro {
280282
err.cancel();
281283
// Don't continue further, since we don't want to have
282284
// `diag_span_note_once` called for a diagnostic that isn't emitted.

0 commit comments

Comments
 (0)