diff options
| author | bors <bors@rust-lang.org> | 2022-08-22 08:32:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-22 08:32:41 +0000 |
| commit | ee8c31e64d229cac4eba6d8f03bb70e16f34a14b (patch) | |
| tree | 0c9ff6127f19cacf68070cea3a978ca3a01d9c4d /compiler/rustc_session/src | |
| parent | a9bb589cd678e034d194193fa892942315b10e2a (diff) | |
| parent | 88e39b2c2e875d78f8c04fe8c6a52a6a48632af5 (diff) | |
| download | rust-ee8c31e64d229cac4eba6d8f03bb70e16f34a14b.tar.gz rust-ee8c31e64d229cac4eba6d8f03bb70e16f34a14b.zip | |
Auto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #93162 (Std module docs improvements) - #99386 (Add tests that check `Vec::retain` predicate execution order.) - #99915 (Recover keywords in trait bounds) - #100694 (Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)) - #100757 (Catch overflow early) Failed merges: - #99917 (Move Error trait into core) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index b9b2356130a..17866dc6bdd 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -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, @@ -374,6 +385,11 @@ impl ParseSess { } #[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, msg: impl Into<DiagnosticMessage>, diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 80de451276c..4972ae2014d 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -482,6 +482,15 @@ impl Session { pub fn emit_warning<'a>(&'a self, warning: impl SessionDiagnostic<'a, ()>) { self.parse_sess.emit_warning(warning) } + pub fn create_fatal<'a>( + &'a self, + fatal: impl SessionDiagnostic<'a, !>, + ) -> DiagnosticBuilder<'a, !> { + self.parse_sess.create_fatal(fatal) + } + pub fn emit_fatal<'a>(&'a self, fatal: impl SessionDiagnostic<'a, !>) -> ! { + self.parse_sess.emit_fatal(fatal) + } #[inline] pub fn err_count(&self) -> usize { self.diagnostic().err_count() |
