diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-04-30 02:20:53 +0100 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-05-02 16:24:18 +0100 |
| commit | d5bc581f5db6ba5198ccec45d938422778f56bff (patch) | |
| tree | c08df852ee3db720944e1389ae6338576c07c276 /compiler/rustc_errors/src | |
| parent | c1bb0e09116c725766f5fa6b4a7ddfef28ef7e96 (diff) | |
Migrate `mir_transform` to translatable diagnostics
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_builder.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 3064d2bedbe..c8e57aa39af 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -570,6 +570,14 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { Some((diagnostic, handler)) } + /// Retrieves the [`Handler`] if available + pub fn handler(&self) -> Option<&Handler> { + match self.inner.state { + DiagnosticBuilderState::Emittable(handler) => Some(handler), + DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => None, + } + } + /// Buffers the diagnostic for later emission, /// unless handler has disabled such buffering. pub fn buffer(self, buffered_diagnostics: &mut Vec<Diagnostic>) { |
