diff options
| author | Ryan Levick <me@ryanlevick.com> | 2021-04-14 18:56:13 +0200 |
|---|---|---|
| committer | Ryan Levick <me@ryanlevick.com> | 2021-04-14 18:56:13 +0200 |
| commit | 43f9d0ae7e0733b1e4e7ad84165ddd57144f2db7 (patch) | |
| tree | 8ff73642b2524d376962858a52d850cc77411446 | |
| parent | aa4457fa5fd1151a7f7a674373c2f4c0df9a3df4 (diff) | |
| download | rust-43f9d0ae7e0733b1e4e7ad84165ddd57144f2db7.tar.gz rust-43f9d0ae7e0733b1e4e7ad84165ddd57144f2db7.zip | |
Cancel emitting FCW lint if it is an edition fixing lint
| -rw-r--r-- | compiler/rustc_middle/src/lint.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 26e61ec8cf8..7adaf54fa23 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -272,11 +272,13 @@ pub fn struct_lint_level<'s, 'd>( // emit shouldn't be automatically fixed by rustfix. err.allow_suggestions(false); - // If this is a future incompatible lint it'll become a hard error, so - // we have to emit *something*. Also, if this lint occurs in the - // expansion of a macro from an external crate, allow individual lints - // to opt-out from being reported. - if future_incompatible.is_none() && !lint.report_in_external_macro { + // If this is a future incompatible that is not an edition fixing lint + // it'll become a hard error, so we have to emit *something*. Also, + // if this lint occurs in the expansion of a macro from an external crate, + // allow individual lints to opt-out from being reported. + let not_future_incompatible = + future_incompatible.map(|f| f.edition.is_some()).unwrap_or(true); + if not_future_incompatible && !lint.report_in_external_macro { err.cancel(); // Don't continue further, since we don't want to have // `diag_span_note_once` called for a diagnostic that isn't emitted. |
