Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 7dfa30b

Browse files
committed
Auto merge of #1741 - rust-lang:bump-to-tokio-1.0, r=Xanewok
Bump to Tokio 1.0 Closes #1695 Closes #1693 Just enabled by tokio-rs/tokio#3388. Work in progress to prune winapi 0.2, still needs patches upstreamed that migrate `parity-tokio-ipc` and `jsonrpc-*` crates to Tokio 1.0. Let's see what CI has to say, first. Blocked on: - [x] paritytech/parity-tokio-ipc#32 - [x] paritytech/jsonrpc#628
2 parents 3a0079a + f612dfd commit 7dfa30b

File tree

8 files changed

+103
-214
lines changed

8 files changed

+103
-214
lines changed

Cargo.lock

+82-191
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "a55912
3838
env_logger = "0.7"
3939
home = "0.5.1"
4040
itertools = "0.9"
41-
jsonrpc-core = "17"
41+
jsonrpc-core = "18"
4242
lsp-types = { version = "0.60", features = ["proposed"] }
4343
lazy_static = "1"
4444
log = "0.4"
@@ -68,9 +68,10 @@ rustc-workspace-hack = "1.0.0"
6868
[dev-dependencies]
6969
difference = "2"
7070
tempfile = "3"
71-
lsp-codec = "0.2"
72-
tokio = { version = "0.2", default-features = false, features = ["rt-core", "time", "io-util", "process", "rt-util"] }
73-
tokio-util = { version = "0.3", default-features = false, features = ["codec"] }
71+
lsp-codec = "0.3"
72+
tokio = { version = "1", default-features = false, features = ["rt", "time", "io-util", "process"] }
73+
tokio-util = { version = "0.6", default-features = false, features = ["codec"] }
74+
tokio-stream = "0.1"
7475
futures = "0.3"
7576

7677
[build-dependencies]

rls-ipc/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ repository = "https://github.com/rust-lang/rls"
99
categories = ["development-tools"]
1010

1111
[dependencies]
12-
jsonrpc-core = "17"
13-
jsonrpc-core-client = "17"
14-
jsonrpc-derive = "17"
15-
jsonrpc-ipc-server = { version = "17", optional = true }
12+
jsonrpc-core = "18"
13+
jsonrpc-core-client = "18"
14+
jsonrpc-derive = "18"
15+
jsonrpc-ipc-server = { version = "18", optional = true }
1616
rls-data = "0.19"
1717
serde = { version = "1.0", features = ["derive"] }
1818

rls-rustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env_logger = "0.7"
1313
log = "0.4"
1414
rand = "0.7"
1515
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "a55912c48e4ac08c0ac39a2d562b44699fa20d4d", optional = true }
16-
tokio = { version = "0.2", optional = true }
16+
tokio = { version = "1", optional = true }
1717
futures = { version = "0.3", optional = true }
1818
serde = { version = "1", features = ["derive"], optional = true }
1919
rls-data = { version = "0.19", optional = true }

rls-rustc/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod ipc;
2727

2828
pub fn run() -> Result<(), ()> {
2929
#[cfg(feature = "ipc")]
30-
let mut rt = tokio::runtime::Runtime::new().unwrap();
30+
let rt = tokio::runtime::Runtime::new().unwrap();
3131
#[cfg(feature = "clippy")]
3232
let clippy_preference = clippy::preference();
3333

tests/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ fn client_fail_uninitialized_request() {
21472147
},
21482148
);
21492149

2150-
rls.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await }).unwrap();
2150+
rls.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await }).unwrap();
21512151

21522152
let err = jsonrpc_core::Failure::deserialize(rls.messages().last().unwrap()).unwrap();
21532153
assert_eq!(err.id, jsonrpc_core::Id::Num(ID));

tests/support/client/child_process.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::process::{Command, Stdio};
44
use std::rc::Rc;
55
use std::task::{Context, Poll};
66

7-
use tokio::io::{AsyncRead, AsyncWrite};
7+
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
88

99
pub struct ChildProcess {
1010
stdin: tokio::process::ChildStdin,
@@ -16,8 +16,8 @@ impl AsyncRead for ChildProcess {
1616
fn poll_read(
1717
mut self: Pin<&mut Self>,
1818
cx: &mut Context<'_>,
19-
buf: &mut [u8],
20-
) -> Poll<io::Result<usize>> {
19+
buf: &mut ReadBuf<'_>,
20+
) -> Poll<io::Result<()>> {
2121
Pin::new(&mut self.stdout).poll_read(cx, buf)
2222
}
2323
}

tests/support/client/mod.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@ impl Project {
6666
}
6767

6868
pub fn spawn_rls_async(&self) -> RlsHandle<ChildProcess> {
69-
let rt = tokio::runtime::Builder::new()
70-
.basic_scheduler()
71-
.enable_all()
72-
.core_threads(1)
73-
.build()
74-
.unwrap();
69+
let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
7570

7671
let cmd = self.rls_cmd();
77-
let process = rt.enter(|| ChildProcess::spawn_from_command(cmd).unwrap());
72+
let guard = rt.enter();
73+
let process = ChildProcess::spawn_from_command(cmd).unwrap();
74+
drop(guard);
7875
self.spawn_rls_with_params(rt, process)
7976
}
8077

@@ -97,7 +94,7 @@ impl Project {
9794
#[allow(clippy::unit_arg)] // We're interested in the side-effects of `process_msg`.
9895
local_set.spawn_local(async move {
9996
use futures::TryStreamExt;
100-
use tokio::stream::StreamExt;
97+
use tokio_stream::StreamExt;
10198

10299
stream
103100
.timeout(rls_timeout())
@@ -178,7 +175,7 @@ impl<T: AsyncRead + AsyncWrite> RlsHandle<T> {
178175
}
179176

180177
/// Block on returned, associated future with a timeout.
181-
pub fn block_on<F: Future>(&mut self, f: F) -> Result<F::Output, tokio::time::Elapsed> {
178+
pub fn block_on<F: Future>(&mut self, f: F) -> Result<F::Output, tokio::time::error::Elapsed> {
182179
self.local_set
183180
.block_on(&mut self.runtime, async { tokio::time::timeout(rls_timeout(), f).await })
184181
}

0 commit comments

Comments
 (0)