Skip to content

Commit 8012200

Browse files
authored
Merge branch 'tokio-rs:master' into master
2 parents f231a51 + e9ae5d4 commit 8012200

File tree

12 files changed

+39
-16
lines changed

12 files changed

+39
-16
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
# Change to specific Rust release to pin
1717
rust_stable: stable
1818
rust_nightly: nightly-2023-10-21
19-
rust_clippy: '1.76'
19+
rust_clippy: '1.77'
2020
# When updating this, also update:
2121
# - README.md
2222
# - tokio/README.md

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ When updating this, also update:
149149
-->
150150

151151
```
152-
cargo +1.76 clippy --all --tests --all-features
152+
cargo +1.77 clippy --all --tests --all-features
153153
```
154154

155155
When building documentation normally, the markers that list the features

tokio-util/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ full = ["codec", "compat", "io-util", "time", "net", "rt"]
2525

2626
net = ["tokio/net"]
2727
compat = ["futures-io",]
28-
codec = ["tracing"]
28+
codec = []
2929
time = ["tokio/time","slab"]
3030
io = []
3131
io-util = ["io", "tokio/rt", "tokio/io-util"]

tokio-util/src/codec/framed_impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::borrow::{Borrow, BorrowMut};
1212
use std::io;
1313
use std::pin::Pin;
1414
use std::task::{Context, Poll};
15-
use tracing::trace;
1615

1716
pin_project! {
1817
#[derive(Debug)]

tokio-util/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ mod cfg;
2525
mod loom;
2626

2727
cfg_codec! {
28+
#[macro_use]
29+
mod tracing;
30+
2831
pub mod codec;
2932
}
3033

tokio-util/src/tracing.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
macro_rules! trace {
2+
($($arg:tt)*) => {
3+
#[cfg(feature = "tracing")]
4+
tracing::trace!($($arg)*);
5+
};
6+
}

tokio-util/tests/compat.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ async fn compat_file_seek() -> futures_util::io::Result<()> {
1515
.read(true)
1616
.write(true)
1717
.create(true)
18+
.truncate(true)
1819
.open(temp_file)
1920
.await?
2021
.compat_write();

tokio/src/io/join.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Join two values implementing `AsyncRead` and `AsyncWrite` into a single one.
22
3-
use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
3+
use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite, ReadBuf};
44

55
use std::io;
66
use std::pin::Pin;
@@ -115,3 +115,16 @@ where
115115
self.writer.is_write_vectored()
116116
}
117117
}
118+
119+
impl<R, W> AsyncBufRead for Join<R, W>
120+
where
121+
R: AsyncBufRead,
122+
{
123+
fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<&[u8]>> {
124+
self.project().reader.poll_fill_buf(cx)
125+
}
126+
127+
fn consume(self: Pin<&mut Self>, amt: usize) {
128+
self.project().reader.consume(amt)
129+
}
130+
}

tokio/src/runtime/signal/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl Driver {
112112
// Drain the pipe completely so we can receive a new readiness event
113113
// if another signal has come in.
114114
let mut buf = [0; 128];
115+
#[allow(clippy::unused_io_amount)]
115116
loop {
116117
match self.receiver.read(&mut buf) {
117118
Ok(0) => panic!("EOF on self-pipe"),

tokio/tests/io_async_fd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn socketpair() -> (FileDescriptor, FileDescriptor) {
150150

151151
fn drain(mut fd: &FileDescriptor) {
152152
let mut buf = [0u8; 512];
153-
153+
#[allow(clippy::unused_io_amount)]
154154
loop {
155155
match fd.read(&mut buf[..]) {
156156
Err(e) if e.kind() == ErrorKind::WouldBlock => break,

tokio/tests/rt_common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ rt_test! {
10891089
use std::thread;
10901090

10911091
thread_local!(
1092-
static R: RefCell<Option<Runtime>> = RefCell::new(None);
1092+
static R: RefCell<Option<Runtime>> = const { RefCell::new(None) };
10931093
);
10941094

10951095
thread::spawn(|| {
@@ -1402,7 +1402,7 @@ rt_test! {
14021402
}
14031403

14041404
std::thread_local! {
1405-
static TL_DATA: RefCell<Option<TLData>> = RefCell::new(None);
1405+
static TL_DATA: RefCell<Option<TLData>> = const { RefCell::new(None) };
14061406
};
14071407

14081408
let (send, recv) = channel();

tokio/tests/task_local_set.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async fn local_current_thread_scheduler() {
3434
#[tokio::test(flavor = "multi_thread")]
3535
async fn local_threadpool() {
3636
thread_local! {
37-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
37+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
3838
}
3939

4040
ON_RT_THREAD.with(|cell| cell.set(true));
@@ -55,7 +55,7 @@ async fn local_threadpool() {
5555
#[tokio::test(flavor = "multi_thread")]
5656
async fn localset_future_threadpool() {
5757
thread_local! {
58-
static ON_LOCAL_THREAD: Cell<bool> = Cell::new(false);
58+
static ON_LOCAL_THREAD: Cell<bool> = const { Cell::new(false) };
5959
}
6060

6161
ON_LOCAL_THREAD.with(|cell| cell.set(true));
@@ -118,7 +118,7 @@ async fn local_threadpool_timer() {
118118
// This test ensures that runtime services like the timer are properly
119119
// set for the local task set.
120120
thread_local! {
121-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
121+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
122122
}
123123

124124
ON_RT_THREAD.with(|cell| cell.set(true));
@@ -158,7 +158,7 @@ fn enter_guard_spawn() {
158158
#[should_panic]
159159
fn local_threadpool_blocking_in_place() {
160160
thread_local! {
161-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
161+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
162162
}
163163

164164
ON_RT_THREAD.with(|cell| cell.set(true));
@@ -182,7 +182,7 @@ fn local_threadpool_blocking_in_place() {
182182
#[tokio::test(flavor = "multi_thread")]
183183
async fn local_threadpool_blocking_run() {
184184
thread_local! {
185-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
185+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
186186
}
187187

188188
ON_RT_THREAD.with(|cell| cell.set(true));
@@ -212,7 +212,7 @@ async fn local_threadpool_blocking_run() {
212212
async fn all_spawns_are_local() {
213213
use futures::future;
214214
thread_local! {
215-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
215+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
216216
}
217217

218218
ON_RT_THREAD.with(|cell| cell.set(true));
@@ -238,7 +238,7 @@ async fn all_spawns_are_local() {
238238
#[tokio::test(flavor = "multi_thread")]
239239
async fn nested_spawn_is_local() {
240240
thread_local! {
241-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
241+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
242242
}
243243

244244
ON_RT_THREAD.with(|cell| cell.set(true));
@@ -274,7 +274,7 @@ async fn nested_spawn_is_local() {
274274
#[test]
275275
fn join_local_future_elsewhere() {
276276
thread_local! {
277-
static ON_RT_THREAD: Cell<bool> = Cell::new(false);
277+
static ON_RT_THREAD: Cell<bool> = const { Cell::new(false) };
278278
}
279279

280280
ON_RT_THREAD.with(|cell| cell.set(true));

0 commit comments

Comments
 (0)