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/Cargo.toml | 1 - crates/ra_db/src/cancelation.rs | 49 +++-------------------------------- crates/ra_lsp_server/src/main_loop.rs | 2 +- 3 files changed, 5 insertions(+), 47 deletions(-) (limited to 'crates') diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 75bcf2b39..ecc56d953 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml @@ -5,7 +5,6 @@ version = "0.1.0" authors = ["Aleksey Kladov "] [dependencies] -backtrace = "0.3.1" relative-path = "0.4.0" salsa = "0.9.0" rustc-hash = "1.0" 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)) - } -} diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 3ebae4ecd..d425b6733 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -432,7 +432,7 @@ impl<'a> PoolDispatcher<'a> { RawResponse::err( id, ErrorCode::ContentModified as i32, - format!("content modified: {:?}", e), + "content modified".to_string(), ) } else { RawResponse::err( -- cgit v1.2.3