Support #[fatal(..)]

This commit is contained in:
finalchild 2022-08-18 21:20:50 +09:00
parent bfefefbcfa
commit b28cc097cf
4 changed files with 27 additions and 2 deletions

View file

@ -360,6 +360,17 @@ impl ParseSess {
self.create_warning(warning).emit()
}
pub fn create_fatal<'a>(
&'a self,
fatal: impl SessionDiagnostic<'a, !>,
) -> DiagnosticBuilder<'a, !> {
fatal.into_diagnostic(self)
}
pub fn emit_fatal<'a>(&'a self, fatal: impl SessionDiagnostic<'a, !>) -> ! {
self.create_fatal(fatal).emit()
}
#[rustc_lint_diagnostics]
pub fn struct_err(
&self,
@ -373,6 +384,11 @@ impl ParseSess {
self.span_diagnostic.struct_warn(msg)
}
#[rustc_lint_diagnostics]
pub fn struct_fatal(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, !> {
self.span_diagnostic.struct_fatal(msg)
}
#[rustc_lint_diagnostics]
pub fn struct_diagnostic<G: EmissionGuarantee>(
&self,