Rollup merge of #111004 - clubby789:migrate-mir-transform, r=oli-obk

Migrate `mir_transform` to translatable diagnostics

cc #100717
This commit is contained in:
Michael Goulet 2023-05-08 09:30:22 -07:00 committed by GitHub
commit 68594142b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 470 additions and 200 deletions

View file

@ -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>) {