@@ -722,7 +722,12 @@ impl Handler {
722
722
self . inner . borrow_mut ( ) . emit_stashed_diagnostics ( )
723
723
}
724
724
725
- /// Construct a builder with the `msg` at the level appropriate for the specific `EmissionGuarantee`.
725
+ /// Construct a builder with the `msg` at the level appropriate for the
726
+ /// specific `EmissionGuarantee`.
727
+ ///
728
+ /// Note: this is necessary for `derive(Diagnostic)`, but shouldn't be used
729
+ /// outside of that. Instead use `struct_err`, `struct_warn`, etc., which
730
+ /// make the diagnostic kind clearer.
726
731
#[ rustc_lint_diagnostics]
727
732
#[ track_caller]
728
733
pub fn struct_diagnostic < G : EmissionGuarantee > (
@@ -937,13 +942,23 @@ impl Handler {
937
942
result
938
943
}
939
944
940
- /// Construct a builder at the `Error ` level with the `msg`.
945
+ /// Construct a builder at the `Fatal ` level with the `msg`.
941
946
#[ rustc_lint_diagnostics]
942
947
#[ track_caller]
943
948
pub fn struct_fatal ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , !> {
944
949
DiagnosticBuilder :: new ( self , Level :: Fatal , msg)
945
950
}
946
951
952
+ /// Construct a builder at the `Fatal` level with the `msg`, that doesn't abort.
953
+ #[ rustc_lint_diagnostics]
954
+ #[ track_caller]
955
+ pub fn struct_almost_fatal (
956
+ & self ,
957
+ msg : impl Into < DiagnosticMessage > ,
958
+ ) -> DiagnosticBuilder < ' _ , FatalError > {
959
+ DiagnosticBuilder :: new ( self , Level :: Fatal , msg)
960
+ }
961
+
947
962
/// Construct a builder at the `Help` level with the `msg`.
948
963
#[ rustc_lint_diagnostics]
949
964
pub fn struct_help ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , ( ) > {
0 commit comments