From 0a8d085619674cd113b6dd903d22233a07fe4839 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 31 Dec 2018 00:38:50 +0300 Subject: remove backtraces from Cancelled Hopefully we won't need them for debugging. If we do need them, it should be easy to add back. --- crates/ra_db/src/cancelation.rs | 49 ++++------------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) (limited to 'crates/ra_db/src') diff --git a/crates/ra_db/src/cancelation.rs b/crates/ra_db/src/cancelation.rs index 73444b015..56ce27bff 100644 --- a/crates/ra_db/src/cancelation.rs +++ b/crates/ra_db/src/cancelation.rs @@ -15,29 +15,17 @@ //! any background processing (this bit is handled by salsa, see //! `BaseDatabase::check_canceled` method). -use std::{ - cmp, - hash::{Hash, Hasher}, - sync::Arc, -}; - -use backtrace::Backtrace; -use parking_lot::Mutex; - /// An "error" signifing that the operation was canceled. -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, Hash)] pub struct Canceled { - backtrace: Arc>, + _private: (), } pub type Cancelable = Result; impl Canceled { pub(crate) fn new() -> Canceled { - let bt = Backtrace::new_unresolved(); - Canceled { - backtrace: Arc::new(Mutex::new(bt)), - } + Canceled { _private: () } } } @@ -49,37 +37,8 @@ impl std::fmt::Display for Canceled { impl std::fmt::Debug for Canceled { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let mut bt = self.backtrace.lock(); - let bt: &mut Backtrace = &mut *bt; - bt.resolve(); - write!(fmt, "canceled at:\n{:?}", bt) + write!(fmt, "Canceled") } } impl std::error::Error for Canceled {} - -impl PartialEq for Canceled { - fn eq(&self, _: &Canceled) -> bool { - true - } -} - -impl Eq for Canceled {} - -impl Hash for Canceled { - fn hash(&self, hasher: &mut H) { - ().hash(hasher) - } -} - -impl cmp::Ord for Canceled { - fn cmp(&self, _: &Canceled) -> cmp::Ordering { - cmp::Ordering::Equal - } -} - -impl cmp::PartialOrd for Canceled { - fn partial_cmp(&self, other: &Canceled) -> Option { - Some(self.cmp(other)) - } -} -- cgit v1.2.3