diff options
| author | Ralf Jung <post@ralfj.de> | 2023-02-18 19:28:51 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-02-18 19:28:51 +0100 |
| commit | 036929d86dc03197668cd9c6673dcbc4e42dfb17 (patch) | |
| tree | 3f8cc5587335245d0f5143a31d6971e224f0cf4a /compiler/rustc_errors/src/lib.rs | |
| parent | aed3b3f38c58714a037c2af47f5c276c135c226f (diff) | |
| parent | 5643706ca2ca59a47966c03104d4b8d931adb2dd (diff) | |
| download | rust-036929d86dc03197668cd9c6673dcbc4e42dfb17.tar.gz rust-036929d86dc03197668cd9c6673dcbc4e42dfb17.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 83b733d4c06..8c39feca88a 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -471,6 +471,8 @@ pub enum StashKey { /// When an invalid lifetime e.g. `'2` should be reinterpreted /// as a char literal in the parser LifetimeIsChar, + /// When an invalid lifetime e.g. `'🐱` contains emoji. + LifetimeContainsEmoji, /// Maybe there was a typo where a comma was forgotten before /// FRU syntax MaybeFruTypo, @@ -1066,29 +1068,26 @@ impl Handler { } pub fn has_errors(&self) -> Option<ErrorGuaranteed> { - if self.inner.borrow().has_errors() { Some(ErrorGuaranteed(())) } else { None } + self.inner.borrow().has_errors().then(ErrorGuaranteed::unchecked_claim_error_was_emitted) } pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> { - if self.inner.borrow().has_errors_or_lint_errors() { - Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) - } else { - None - } + self.inner + .borrow() + .has_errors_or_lint_errors() + .then(ErrorGuaranteed::unchecked_claim_error_was_emitted) } pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> { - if self.inner.borrow().has_errors_or_delayed_span_bugs() { - Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) - } else { - None - } + self.inner + .borrow() + .has_errors_or_delayed_span_bugs() + .then(ErrorGuaranteed::unchecked_claim_error_was_emitted) } pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> { - if self.inner.borrow().is_compilation_going_to_fail() { - Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) - } else { - None - } + self.inner + .borrow() + .is_compilation_going_to_fail() + .then(ErrorGuaranteed::unchecked_claim_error_was_emitted) } pub fn print_error_count(&self, registry: &Registry) { |
