diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-30 21:39:50 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-30 21:39:50 +0000 |
commit | e2816a95e94eb59fc875295ce7f3f547e95fe7b1 (patch) | |
tree | ed180196ff6cfc2cfa7dd71f0728decbccbd11b2 | |
parent | dee7c3b0de9650216bd761e587d0e1d4cca52981 (diff) | |
parent | 0a8d085619674cd113b6dd903d22233a07fe4839 (diff) |
Merge #380
380: no-backtrace r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | crates/ra_db/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_db/src/cancelation.rs | 49 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 2 |
4 files changed, 5 insertions, 48 deletions
diff --git a/Cargo.lock b/Cargo.lock index 150e6d1ea..39dd6a3cf 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -697,7 +697,6 @@ dependencies = [ | |||
697 | name = "ra_db" | 697 | name = "ra_db" |
698 | version = "0.1.0" | 698 | version = "0.1.0" |
699 | dependencies = [ | 699 | dependencies = [ |
700 | "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
701 | "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | 700 | "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", |
702 | "ra_editor 0.1.0", | 701 | "ra_editor 0.1.0", |
703 | "ra_syntax 0.1.0", | 702 | "ra_syntax 0.1.0", |
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" | |||
5 | authors = ["Aleksey Kladov <[email protected]>"] | 5 | authors = ["Aleksey Kladov <[email protected]>"] |
6 | 6 | ||
7 | [dependencies] | 7 | [dependencies] |
8 | backtrace = "0.3.1" | ||
9 | relative-path = "0.4.0" | 8 | relative-path = "0.4.0" |
10 | salsa = "0.9.0" | 9 | salsa = "0.9.0" |
11 | rustc-hash = "1.0" | 10 | 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 @@ | |||
15 | //! any background processing (this bit is handled by salsa, see | 15 | //! any background processing (this bit is handled by salsa, see |
16 | //! `BaseDatabase::check_canceled` method). | 16 | //! `BaseDatabase::check_canceled` method). |
17 | 17 | ||
18 | use std::{ | ||
19 | cmp, | ||
20 | hash::{Hash, Hasher}, | ||
21 | sync::Arc, | ||
22 | }; | ||
23 | |||
24 | use backtrace::Backtrace; | ||
25 | use parking_lot::Mutex; | ||
26 | |||
27 | /// An "error" signifing that the operation was canceled. | 18 | /// An "error" signifing that the operation was canceled. |
28 | #[derive(Clone)] | 19 | #[derive(Clone, PartialEq, Eq, Hash)] |
29 | pub struct Canceled { | 20 | pub struct Canceled { |
30 | backtrace: Arc<Mutex<Backtrace>>, | 21 | _private: (), |
31 | } | 22 | } |
32 | 23 | ||
33 | pub type Cancelable<T> = Result<T, Canceled>; | 24 | pub type Cancelable<T> = Result<T, Canceled>; |
34 | 25 | ||
35 | impl Canceled { | 26 | impl Canceled { |
36 | pub(crate) fn new() -> Canceled { | 27 | pub(crate) fn new() -> Canceled { |
37 | let bt = Backtrace::new_unresolved(); | 28 | Canceled { _private: () } |
38 | Canceled { | ||
39 | backtrace: Arc::new(Mutex::new(bt)), | ||
40 | } | ||
41 | } | 29 | } |
42 | } | 30 | } |
43 | 31 | ||
@@ -49,37 +37,8 @@ impl std::fmt::Display for Canceled { | |||
49 | 37 | ||
50 | impl std::fmt::Debug for Canceled { | 38 | impl std::fmt::Debug for Canceled { |
51 | fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 39 | fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
52 | let mut bt = self.backtrace.lock(); | 40 | write!(fmt, "Canceled") |
53 | let bt: &mut Backtrace = &mut *bt; | ||
54 | bt.resolve(); | ||
55 | write!(fmt, "canceled at:\n{:?}", bt) | ||
56 | } | 41 | } |
57 | } | 42 | } |
58 | 43 | ||
59 | impl std::error::Error for Canceled {} | 44 | impl std::error::Error for Canceled {} |
60 | |||
61 | impl PartialEq for Canceled { | ||
62 | fn eq(&self, _: &Canceled) -> bool { | ||
63 | true | ||
64 | } | ||
65 | } | ||
66 | |||
67 | impl Eq for Canceled {} | ||
68 | |||
69 | impl Hash for Canceled { | ||
70 | fn hash<H: Hasher>(&self, hasher: &mut H) { | ||
71 | ().hash(hasher) | ||
72 | } | ||
73 | } | ||
74 | |||
75 | impl cmp::Ord for Canceled { | ||
76 | fn cmp(&self, _: &Canceled) -> cmp::Ordering { | ||
77 | cmp::Ordering::Equal | ||
78 | } | ||
79 | } | ||
80 | |||
81 | impl cmp::PartialOrd for Canceled { | ||
82 | fn partial_cmp(&self, other: &Canceled) -> Option<cmp::Ordering> { | ||
83 | Some(self.cmp(other)) | ||
84 | } | ||
85 | } | ||
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> { | |||
432 | RawResponse::err( | 432 | RawResponse::err( |
433 | id, | 433 | id, |
434 | ErrorCode::ContentModified as i32, | 434 | ErrorCode::ContentModified as i32, |
435 | format!("content modified: {:?}", e), | 435 | "content modified".to_string(), |
436 | ) | 436 | ) |
437 | } else { | 437 | } else { |
438 | RawResponse::err( | 438 | RawResponse::err( |