about summary refs log tree commit diff
path: root/compiler/rustc_span/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-26 12:40:05 +0000
committerbors <bors@rust-lang.org>2023-02-26 12:40:05 +0000
commitc4e0cd966062ca67daed20775f4e8a60c28e57df (patch)
treea76fa48fe30ba83326439fadaae6a62890573e4b /compiler/rustc_span/src/lib.rs
parent43ee4d15bf201f72c36abd7f02961df87dead441 (diff)
parent9c27fc7d34512a6b3d34247beab4a6ada2476c58 (diff)
downloadrust-c4e0cd966062ca67daed20775f4e8a60c28e57df.tar.gz
rust-c4e0cd966062ca67daed20775f4e8a60c28e57df.zip
Auto merge of #108488 - matthiaskrgr:rollup-i61epcw, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #107941 (Treat `str` as containing `[u8]` for auto trait purposes)
 - #108299 (Require `literal`s for some `(u)int_impl!` parameters)
 - #108337 (hir-analysis: make a helpful note)
 - #108379 (Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants)
 - #108418 (Replace parse_[sth]_expr with parse_expr_[sth] function names)
 - #108424 (rustc_infer: Consolidate obligation elaboration de-duplication)
 - #108475 (Fix `VecDeque::shrink_to` and add tests.)
 - #108482 (statically guarantee that current error codes are documented)
 - #108484 (Remove `from` lang item)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_span/src/lib.rs')
-rw-r--r--compiler/rustc_span/src/lib.rs14
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(())
+    }
+}