diff options
| author | mark <markm@cs.wisc.edu> | 2022-01-23 12:34:26 -0600 |
|---|---|---|
| committer | mark <markm@cs.wisc.edu> | 2022-03-02 09:45:25 -0600 |
| commit | e489a94deef3d41513fe4254804d730f0fd6cbc0 (patch) | |
| tree | d2c3743151e614831817cb8c27487a820826cc29 /compiler/rustc_errors | |
| parent | c42d846add941a26bd254911e16f02c4a3f9346f (diff) | |
| download | rust-e489a94deef3d41513fe4254804d730f0fd6cbc0.tar.gz rust-e489a94deef3d41513fe4254804d730f0fd6cbc0.zip | |
rename ErrorReported -> ErrorGuaranteed
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_builder.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 20 |
2 files changed, 19 insertions, 19 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 49305d22684..5dc71f16200 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -1,4 +1,4 @@ -use crate::{Diagnostic, DiagnosticId, DiagnosticStyledString, ErrorReported}; +use crate::{Diagnostic, DiagnosticId, DiagnosticStyledString, ErrorGuaranteed}; use crate::{Handler, Level, StashKey}; use rustc_lint_defs::Applicability; @@ -96,7 +96,7 @@ mod sealed_level_is_error { impl IsError<{ Level::Error { lint: false } }> for () {} } -impl<'a> DiagnosticBuilder<'a, ErrorReported> { +impl<'a> DiagnosticBuilder<'a, ErrorGuaranteed> { /// Convenience function for internal use, clients should use one of the /// `struct_*` methods on [`Handler`]. crate fn new_guaranteeing_error<const L: Level>(handler: &'a Handler, message: &str) -> Self @@ -120,8 +120,8 @@ impl<'a> DiagnosticBuilder<'a, ErrorReported> { } } -// FIXME(eddyb) make `ErrorReported` impossible to create outside `.emit()`. -impl EmissionGuarantee for ErrorReported { +// FIXME(eddyb) make `ErrorGuaranteed` impossible to create outside `.emit()`. +impl EmissionGuarantee for ErrorGuaranteed { fn diagnostic_builder_emit_producing_guarantee(db: &mut DiagnosticBuilder<'_, Self>) -> Self { match db.inner.state { // First `.emit()` call, the `&Handler` is still available. @@ -136,10 +136,10 @@ impl EmissionGuarantee for ErrorReported { assert!( db.inner.diagnostic.is_error(), "emitted non-error ({:?}) diagnostic \ - from `DiagnosticBuilder<ErrorReported>`", + from `DiagnosticBuilder<ErrorGuaranteed>`", db.inner.diagnostic.level, ); - ErrorReported + ErrorGuaranteed } // `.emit()` was previously called, disallowed from repeating it, // but can take advantage of the previous `.emit()`'s guarantee @@ -150,11 +150,11 @@ impl EmissionGuarantee for ErrorReported { // can be overwritten with a new one, thanks to `DerefMut`. assert!( db.inner.diagnostic.is_error(), - "`DiagnosticBuilder<ErrorReported>`'s diagnostic \ + "`DiagnosticBuilder<ErrorGuaranteed>`'s diagnostic \ became non-error ({:?}), after original `.emit()`", db.inner.diagnostic.level, ); - ErrorReported + ErrorGuaranteed } } } @@ -182,7 +182,7 @@ impl<'a> DiagnosticBuilder<'a, ()> { } } -// FIXME(eddyb) should there be a `Option<ErrorReported>` impl as well? +// FIXME(eddyb) should there be a `Option<ErrorGuaranteed>` impl as well? impl EmissionGuarantee for () { fn diagnostic_builder_emit_producing_guarantee(db: &mut DiagnosticBuilder<'_, Self>) -> Self { match db.inner.state { diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index fdfedffc529..e45a57b2658 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -54,7 +54,7 @@ mod snippet; mod styled_buffer; pub use snippet::Style; -pub type PResult<'a, T> = Result<T, DiagnosticBuilder<'a, ErrorReported>>; +pub type PResult<'a, T> = Result<T, DiagnosticBuilder<'a, ErrorGuaranteed>>; // `PResult` is used a lot. Make sure it doesn't unintentionally get bigger. // (See also the comment on `DiagnosticBuilder`'s `diagnostic` field.) @@ -682,7 +682,7 @@ impl Handler { &self, span: impl Into<MultiSpan>, msg: &str, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { let mut result = self.struct_err(msg); result.set_span(span); result @@ -694,7 +694,7 @@ impl Handler { span: impl Into<MultiSpan>, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { let mut result = self.struct_span_err(span, msg); result.code(code); result @@ -702,7 +702,7 @@ impl Handler { /// Construct a builder at the `Error` level with the `msg`. // 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> { DiagnosticBuilder::new_guaranteeing_error::<{ Level::Error { lint: false } }>(self, msg) } @@ -717,7 +717,7 @@ impl Handler { &self, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { let mut result = self.struct_err(msg); result.code(code); result @@ -728,7 +728,7 @@ impl Handler { &self, span: impl Into<MultiSpan>, msg: &str, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { let mut result = self.struct_fatal(msg); result.set_span(span); result @@ -740,14 +740,14 @@ impl Handler { span: impl Into<MultiSpan>, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'_, ErrorReported> { + ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { let mut result = self.struct_span_fatal(span, msg); result.code(code); result } /// Construct a builder at the `Error` level with the `msg`. - pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorReported> { + pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorGuaranteed> { DiagnosticBuilder::new_guaranteeing_error::<{ Level::Fatal }>(self, msg) } @@ -1343,6 +1343,6 @@ pub fn add_elided_lifetime_in_path_suggestion( // Useful type to use with `Result<>` indicate that an error has already // been reported to the user, so no need to continue checking. #[derive(Clone, Copy, Debug, Encodable, Decodable, Hash, PartialEq, Eq)] -pub struct ErrorReported; +pub struct ErrorGuaranteed; -rustc_data_structures::impl_stable_hash_via_hash!(ErrorReported); +rustc_data_structures::impl_stable_hash_via_hash!(ErrorGuaranteed); |
