aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/Cargo.toml1
-rw-r--r--crates/ra_analysis/src/job.rs53
-rw-r--r--crates/ra_analysis/src/lib.rs4
3 files changed, 0 insertions, 58 deletions
diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml
index dd4ec8375..d7ac69fe8 100644
--- a/crates/ra_analysis/Cargo.toml
+++ b/crates/ra_analysis/Cargo.toml
@@ -7,7 +7,6 @@ authors = ["Aleksey Kladov <[email protected]>"]
7[dependencies] 7[dependencies]
8relative-path = "0.3.7" 8relative-path = "0.3.7"
9log = "0.4.2" 9log = "0.4.2"
10crossbeam-channel = "0.2.4"
11parking_lot = "0.6.3" 10parking_lot = "0.6.3"
12once_cell = "0.1.5" 11once_cell = "0.1.5"
13rayon = "1.0.2" 12rayon = "1.0.2"
diff --git a/crates/ra_analysis/src/job.rs b/crates/ra_analysis/src/job.rs
deleted file mode 100644
index 2871f9839..000000000
--- a/crates/ra_analysis/src/job.rs
+++ /dev/null
@@ -1,53 +0,0 @@
1use crossbeam_channel::{bounded, Receiver, Sender};
2
3pub struct JobHandle {
4 job_alive: Receiver<Never>,
5 _job_canceled: Sender<Never>,
6}
7
8pub struct JobToken {
9 _job_alive: Sender<Never>,
10 job_canceled: Receiver<Never>,
11}
12
13impl JobHandle {
14 pub fn new() -> (JobHandle, JobToken) {
15 let (sender_alive, receiver_alive) = bounded(0);
16 let (sender_canceled, receiver_canceled) = bounded(0);
17 let token = JobToken {
18 _job_alive: sender_alive,
19 job_canceled: receiver_canceled,
20 };
21 let handle = JobHandle {
22 job_alive: receiver_alive,
23 _job_canceled: sender_canceled,
24 };
25 (handle, token)
26 }
27 pub fn has_completed(&self) -> bool {
28 is_closed(&self.job_alive)
29 }
30 pub fn cancel(self) {}
31}
32
33impl JobToken {
34 pub fn is_canceled(&self) -> bool {
35 is_closed(&self.job_canceled)
36 }
37}
38
39// We don't actually send messages through the channels,
40// and instead just check if the channel is closed,
41// so we use uninhabited enum as a message type
42enum Never {}
43
44/// Nonblocking
45fn is_closed(chan: &Receiver<Never>) -> bool {
46 select! {
47 recv(chan, msg) => match msg {
48 None => true,
49 Some(never) => match never {}
50 }
51 default => false,
52 }
53}
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 750031093..28e0a12b2 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -7,8 +7,6 @@ extern crate ra_editor;
7extern crate ra_syntax; 7extern crate ra_syntax;
8extern crate rayon; 8extern crate rayon;
9extern crate relative_path; 9extern crate relative_path;
10#[macro_use]
11extern crate crossbeam_channel;
12extern crate im; 10extern crate im;
13extern crate rustc_hash; 11extern crate rustc_hash;
14extern crate salsa; 12extern crate salsa;
@@ -16,7 +14,6 @@ extern crate salsa;
16mod db; 14mod db;
17mod descriptors; 15mod descriptors;
18mod imp; 16mod imp;
19mod job;
20mod module_map; 17mod module_map;
21mod roots; 18mod roots;
22mod symbol_index; 19mod symbol_index;
@@ -31,7 +28,6 @@ use crate::imp::{AnalysisHostImpl, AnalysisImpl, FileResolverImp};
31 28
32pub use crate::{ 29pub use crate::{
33 descriptors::FnDescriptor, 30 descriptors::FnDescriptor,
34 job::{JobHandle, JobToken},
35}; 31};
36pub use ra_editor::{ 32pub use ra_editor::{
37 CompletionItem, FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, 33 CompletionItem, FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable,