diff options
| author | Michael Goulet <michael@errs.io> | 2023-05-08 09:30:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-08 09:30:22 -0700 |
| commit | 68594142b112305d3a19e425724405802efd7806 (patch) | |
| tree | c2f0a0a6481753a24932a136caf1d7eddb40c845 /compiler/rustc_errors/src | |
| parent | 29ac429c9bd5f6aa5af8d2c04f3ef8732cd8bd15 (diff) | |
| parent | d5bc581f5db6ba5198ccec45d938422778f56bff (diff) | |
| download | rust-68594142b112305d3a19e425724405802efd7806.tar.gz rust-68594142b112305d3a19e425724405802efd7806.zip | |
Rollup merge of #111004 - clubby789:migrate-mir-transform, r=oli-obk
Migrate `mir_transform` to translatable diagnostics cc #100717
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 ef528d87cb2..db97d96fccd 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -571,6 +571,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>) { |
