Force warnings even when can_emit_warnings == false

This commit is contained in:
Ryan Levick 2021-06-04 14:37:20 +02:00
parent e98897e5dc
commit a3d6905053
8 changed files with 54 additions and 8 deletions

View file

@ -29,7 +29,7 @@ pub struct Diagnostic {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
pub enum DiagnosticId {
Error(String),
Lint { name: String, has_future_breakage: bool },
Lint { name: String, has_future_breakage: bool, is_force_warn: bool },
}
/// A "sub"-diagnostic attached to a parent diagnostic.
@ -109,6 +109,13 @@ impl Diagnostic {
}
}
pub fn is_force_warn(&self) -> bool {
match self.code {
Some(DiagnosticId::Lint { is_force_warn, .. }) => is_force_warn,
_ => false,
}
}
/// Cancel the diagnostic (a structured diagnostic must either be emitted or
/// canceled or it will panic when dropped).
pub fn cancel(&mut self) {