diff options
Diffstat (limited to 'compiler/rustc_session/src/session.rs')
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index b72be735ce4..360682558a5 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -19,7 +19,7 @@ use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter; use rustc_errors::emitter::{Emitter, EmitterWriter, HumanReadableErrorType}; use rustc_errors::json::JsonEmitter; use rustc_errors::registry::Registry; -use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorReported}; +use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorGuaranteed}; use rustc_macros::HashStable_Generic; pub use rustc_span::def_id::StableCrateId; use rustc_span::edition::Edition; @@ -221,7 +221,7 @@ enum DiagnosticBuilderMethod { pub trait SessionDiagnostic<'a> { /// Write out as a diagnostic out of `sess`. #[must_use] - fn into_diagnostic(self, sess: &'a Session) -> DiagnosticBuilder<'a, ErrorReported>; + fn into_diagnostic(self, sess: &'a Session) -> DiagnosticBuilder<'a, ErrorGuaranteed>; } /// Diagnostic message ID, used by `Session.one_time_diagnostics` to avoid @@ -335,7 +335,7 @@ impl Session { &self, sp: S, msg: &str, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_span_err(sp, msg) } pub fn struct_span_err_with_code<S: Into<MultiSpan>>( @@ -343,25 +343,25 @@ impl Session { sp: S, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_span_err_with_code(sp, msg, code) } // FIXME: This method should be removed (every error should have an associated error code). - pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorReported> { + pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_err(msg) } pub fn struct_err_with_code( &self, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_err_with_code(msg, code) } pub fn struct_span_fatal<S: Into<MultiSpan>>( &self, sp: S, msg: &str, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_span_fatal(sp, msg) } pub fn struct_span_fatal_with_code<S: Into<MultiSpan>>( @@ -369,10 +369,10 @@ impl Session { sp: S, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_span_fatal_with_code(sp, msg, code) } - pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorReported> { + pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorGuaranteed> { self.diagnostic().struct_fatal(msg) } @@ -406,7 +406,7 @@ impl Session { pub fn err(&self, msg: &str) { self.diagnostic().err(msg) } - pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorReported { + pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed { err.into_diagnostic(self).emit() } #[inline] @@ -422,22 +422,22 @@ impl Session { pub fn abort_if_errors(&self) { self.diagnostic().abort_if_errors(); } - pub fn compile_status(&self) -> Result<(), ErrorReported> { + pub fn compile_status(&self) -> Result<(), ErrorGuaranteed> { if self.diagnostic().has_errors_or_lint_errors() { self.diagnostic().emit_stashed_diagnostics(); - Err(ErrorReported) + Err(ErrorGuaranteed) } else { Ok(()) } } // FIXME(matthewjasper) Remove this method, it should never be needed. - pub fn track_errors<F, T>(&self, f: F) -> Result<T, ErrorReported> + pub fn track_errors<F, T>(&self, f: F) -> Result<T, ErrorGuaranteed> where F: FnOnce() -> T, { let old_count = self.err_count(); let result = f(); - if self.err_count() == old_count { Ok(result) } else { Err(ErrorReported) } + if self.err_count() == old_count { Ok(result) } else { Err(ErrorGuaranteed) } } pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str) { self.diagnostic().span_warn(sp, msg) |
