diff options
| author | Michael Goulet <michael@errs.io> | 2023-02-22 21:19:42 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-02-25 19:46:36 +0000 |
| commit | a772a6fc2ad9ab0872af238fe2e641dcf379a2cd (patch) | |
| tree | 1eaa346d9036e415a072914b941f1b8d697b46d0 /compiler/rustc_span/src | |
| parent | dcca6a375bd4eddb3deea7038ebf29d02af53b48 (diff) | |
| download | rust-a772a6fc2ad9ab0872af238fe2e641dcf379a2cd.tar.gz rust-a772a6fc2ad9ab0872af238fe2e641dcf379a2cd.zip | |
Add ErrorGuaranteed to HIR TyKind::Err
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index e112100aa5f..873cd33f6a4 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -2149,3 +2149,17 @@ where Hash::hash(&len, hasher); } } + +/// 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, PartialOrd, Ord)] +#[derive(HashStable_Generic)] +pub struct ErrorGuaranteed(()); + +impl ErrorGuaranteed { + /// To be used only if you really know what you are doing... ideally, we would find a way to + /// eliminate all calls to this method. + pub fn unchecked_claim_error_was_emitted() -> Self { + ErrorGuaranteed(()) + } +} |
