aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src/cancellation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db/src/cancellation.rs')
-rw-r--r--crates/ra_db/src/cancellation.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_db/src/cancellation.rs b/crates/ra_db/src/cancellation.rs
index 8d38eebfb..32a268553 100644
--- a/crates/ra_db/src/cancellation.rs
+++ b/crates/ra_db/src/cancellation.rs
@@ -27,6 +27,12 @@ impl Canceled {
27 pub(crate) fn new() -> Canceled { 27 pub(crate) fn new() -> Canceled {
28 Canceled { _private: () } 28 Canceled { _private: () }
29 } 29 }
30
31 pub fn throw() -> ! {
32 // We use resume and not panic here to avoid running the panic
33 // hook (that is, to avoid collecting and printing backtrace).
34 std::panic::resume_unwind(Box::new(Canceled::new()))
35 }
30} 36}
31 37
32impl std::fmt::Display for Canceled { 38impl std::fmt::Display for Canceled {