diff options
| author | Ryan Levick <me@ryanlevick.com> | 2021-06-04 14:37:20 +0200 |
|---|---|---|
| committer | Ryan Levick <me@ryanlevick.com> | 2021-06-30 11:18:33 +0200 |
| commit | a3d6905053ad60e836717976e6e4d38de67888f9 (patch) | |
| tree | 449121ebebeb9cf0593c2fc3e883d18b337a9e6e /compiler/rustc_errors/src/diagnostic.rs | |
| parent | e98897e5dc9898707bf4331c43b2e76ab7e282fe (diff) | |
| download | rust-a3d6905053ad60e836717976e6e4d38de67888f9.tar.gz rust-a3d6905053ad60e836717976e6e4d38de67888f9.zip | |
Force warnings even when can_emit_warnings == false
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic.rs')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 14ccced2c6a..45661ac1562 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -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) { |
