Support lint expectations for --force-warn lints (RFC 2383)

This commit is contained in:
xFrednet 2022-06-05 12:33:45 +02:00
parent ec55c61305
commit 8527a3d369
No known key found for this signature in database
GPG key ID: F5C59D0E669E5302
19 changed files with 317 additions and 71 deletions

View file

@ -208,7 +208,7 @@ impl Diagnostic {
| Level::Error { .. }
| Level::FailureNote => true,
Level::Warning
Level::Warning(_)
| Level::Note
| Level::OnceNote
| Level::Help
@ -221,7 +221,9 @@ impl Diagnostic {
&mut self,
unstable_to_stable: &FxHashMap<LintExpectationId, LintExpectationId>,
) {
if let Level::Expect(expectation_id) = &mut self.level {
if let Level::Expect(expectation_id) | Level::Warning(Some(expectation_id)) =
&mut self.level
{
if expectation_id.is_stable() {
return;
}
@ -445,7 +447,7 @@ impl Diagnostic {
/// Add a warning attached to this diagnostic.
pub fn warn(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
self.sub(Level::Warning, msg, MultiSpan::new(), None);
self.sub(Level::Warning(None), msg, MultiSpan::new(), None);
self
}
@ -456,7 +458,7 @@ impl Diagnostic {
sp: S,
msg: impl Into<SubdiagnosticMessage>,
) -> &mut Self {
self.sub(Level::Warning, msg, sp.into(), None);
self.sub(Level::Warning(None), msg, sp.into(), None);
self
}