Explain why -D warnings doesn't affect linker-warnings

This commit is contained in:
jyn
2026-04-26 16:07:28 +00:00
parent ff6b935df4
commit e09d7c19f4
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -305,6 +305,18 @@ fn explain_lint_level_source(
}
}
}
if let Some(warnings_group) = sess
.opts
.lint_opts
.iter()
.find_map(|(opt, level)| (opt == "warnings").then_some(level))
.copied()
&& warnings_group >= Level::Deny
&& level < warnings_group
{
err.note_once(format!("the `{name}` lint ignores `-D warnings`"));
}
}
/// The innermost function for emitting lints implementing the [`trait@Diagnostic`] trait.
@@ -1,6 +1,7 @@
warning: linker stderr: bar
|
= note: requested on the command line with `-W linker-messages`
= note: the `linker_messages` lint ignores `-D warnings`
warning: 1 warning emitted