summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/lint.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /compiler/rustc_middle/src/lint.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_middle/src/lint.rs')
-rw-r--r--compiler/rustc_middle/src/lint.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 14343ac11..81c1ae4f6 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -251,7 +251,7 @@ pub fn explain_lint_level_source(
}
LintLevelSource::Node { name: lint_attr_name, span, reason, .. } => {
if let Some(rationale) = reason {
- err.note(rationale.as_str());
+ err.note(rationale.to_string());
}
err.span_note_once(span, "the lint level is defined here");
if lint_attr_name.as_str() != name {
@@ -388,10 +388,11 @@ pub fn struct_lint_level(
// 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.reason.edition().is_some()).unwrap_or(true);
- if not_future_incompatible && !lint.report_in_external_macro {
+ let incompatible = future_incompatible.is_some_and(|f| f.reason.edition().is_none());
+
+ if !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.
return;