summaryrefslogtreecommitdiff
path: root/user/rust/0040-rls-atomics.patch
blob: 4dd813faa074afcb1f002dc7f1537e2062511d5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff --git a/src/tools/rls/src/cmd.rs b/src/tools/rls/src/cmd.rs
index 64035aa..d9129d8 100644
--- a/src/tools/rls/src/cmd.rs
+++ b/src/tools/rls/src/cmd.rs
@@ -17,7 +17,7 @@ use crate::config::Config;
 use crate::server::{self, LsService, Notification, Request, RequestId};
 use rls_analysis::{AnalysisHost, Target};
 use rls_vfs::Vfs;
-use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::atomic::{AtomicU32, Ordering};
 
 use languageserver_types::{
     ClientCapabilities, CodeActionContext, CodeActionParams, CompletionItem,
@@ -424,8 +424,8 @@ fn url(file_name: &str) -> Url {
 }
 
 fn next_id() -> RequestId {
-    static ID: AtomicU64 = AtomicU64::new(1);
-    RequestId::Num(ID.fetch_add(1, Ordering::SeqCst))
+    static ID: AtomicU32 = AtomicU32::new(1);
+    RequestId::Num(ID.fetch_add(1, Ordering::SeqCst).into())
 }
 
 // Custom reader and output for the RLS server.
diff --git a/src/tools/rls/src/server/io.rs b/src/tools/rls/src/server/io.rs
index 7b93d4a..f3c5361 100644
--- a/src/tools/rls/src/server/io.rs
+++ b/src/tools/rls/src/server/io.rs
@@ -17,7 +17,7 @@ use crate::lsp_data::{LSPNotification, LSPRequest};
 
 use std::fmt;
 use std::io::{self, BufRead, Write};
-use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::atomic::{AtomicU32, Ordering};
 use std::sync::Arc;
 
 use jsonrpc_core::{self as jsonrpc, response, version, Id};
@@ -190,14 +190,14 @@ pub trait Output: Sync + Send + Clone + 'static {
 /// An output that sends notifications and responses on `stdout`.
 #[derive(Clone)]
 pub(super) struct StdioOutput {
-    next_id: Arc<AtomicU64>,
+    next_id: Arc<AtomicU32>,
 }
 
 impl StdioOutput {
     /// Construct a new `stdout` output.
     crate fn new() -> StdioOutput {
         StdioOutput {
-            next_id: Arc::new(AtomicU64::new(1)),
+            next_id: Arc::new(AtomicU32::new(1).into()),
         }
     }
 }
@@ -215,7 +215,7 @@ impl Output for StdioOutput {
     }
 
     fn provide_id(&self) -> RequestId {
-        RequestId::Num(self.next_id.fetch_add(1, Ordering::SeqCst))
+        RequestId::Num(self.next_id.fetch_add(1, Ordering::SeqCst).into())
     }
 }