diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index 9fdfb5bd769..984e999595f 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -6,7 +6,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(intra_doc_link_resolution_failure)] +#![deny(rustdoc::broken_intra_doc_links)] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) diff --git a/tokio-test/src/lib.rs b/tokio-test/src/lib.rs index c109c148145..1535c06dc28 100644 --- a/tokio-test/src/lib.rs +++ b/tokio-test/src/lib.rs @@ -5,7 +5,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(intra_doc_link_resolution_failure)] +#![deny(rustdoc::broken_intra_doc_links)] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) diff --git a/tokio-tls/src/lib.rs b/tokio-tls/src/lib.rs index 2770650934b..5074a962a38 100644 --- a/tokio-tls/src/lib.rs +++ b/tokio-tls/src/lib.rs @@ -5,7 +5,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(intra_doc_link_resolution_failure)] +#![deny(rustdoc::broken_intra_doc_links)] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) diff --git a/tokio-tls/tests/smoke.rs b/tokio-tls/tests/smoke.rs index 8788dd6d467..ead7fbbd141 100644 --- a/tokio-tls/tests/smoke.rs +++ b/tokio-tls/tests/smoke.rs @@ -617,7 +617,7 @@ async fn one_byte_at_a_time() { match socket.read_exact(&mut buf).await { Ok(_) => data.extend_from_slice(&buf), Err(ref err) if err.kind() == ErrorKind::UnexpectedEof => break, - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } data diff --git a/tokio-util/src/lib.rs b/tokio-util/src/lib.rs index 4554516e05b..d8c7fa97213 100644 --- a/tokio-util/src/lib.rs +++ b/tokio-util/src/lib.rs @@ -6,7 +6,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(intra_doc_link_resolution_failure)] +#![deny(rustdoc::broken_intra_doc_links)] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) diff --git a/tokio/src/io/async_buf_read.rs b/tokio/src/io/async_buf_read.rs index 1ab73cd9b70..1c1fae36588 100644 --- a/tokio/src/io/async_buf_read.rs +++ b/tokio/src/io/async_buf_read.rs @@ -60,16 +60,14 @@ pub trait AsyncBufRead: AsyncRead { macro_rules! deref_async_buf_read { () => { - fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) - -> Poll> - { + fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { Pin::new(&mut **self.get_mut()).poll_fill_buf(cx) } fn consume(mut self: Pin<&mut Self>, amt: usize) { Pin::new(&mut **self).consume(amt) } - } + }; } impl AsyncBufRead for Box { diff --git a/tokio/src/io/async_read.rs b/tokio/src/io/async_read.rs index de08d65810b..cc9091c99c1 100644 --- a/tokio/src/io/async_read.rs +++ b/tokio/src/io/async_read.rs @@ -140,12 +140,14 @@ macro_rules! deref_async_read { (**self).prepare_uninitialized_buffer(buf) } - fn poll_read(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) - -> Poll> - { + fn poll_read( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut [u8], + ) -> Poll> { Pin::new(&mut **self).poll_read(cx, buf) } - } + }; } impl AsyncRead for Box { diff --git a/tokio/src/io/async_seek.rs b/tokio/src/io/async_seek.rs index 0be9c90d562..32ed0a22ab9 100644 --- a/tokio/src/io/async_seek.rs +++ b/tokio/src/io/async_seek.rs @@ -55,13 +55,10 @@ macro_rules! deref_async_seek { Pin::new(&mut **self).start_seek(cx, pos) } - fn poll_complete( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - ) -> Poll> { + fn poll_complete(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { Pin::new(&mut **self).poll_complete(cx) } - } + }; } impl AsyncSeek for Box { diff --git a/tokio/src/io/async_write.rs b/tokio/src/io/async_write.rs index 0bfed056ef6..42e09f1ff85 100644 --- a/tokio/src/io/async_write.rs +++ b/tokio/src/io/async_write.rs @@ -153,9 +153,11 @@ pub trait AsyncWrite { macro_rules! deref_async_write { () => { - fn poll_write(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) - -> Poll> - { + fn poll_write( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &[u8], + ) -> Poll> { Pin::new(&mut **self).poll_write(cx, buf) } @@ -166,7 +168,7 @@ macro_rules! deref_async_write { fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { Pin::new(&mut **self).poll_shutdown(cx) } - } + }; } impl AsyncWrite for Box { diff --git a/tokio/src/io/split.rs b/tokio/src/io/split.rs index 134b937a5f1..653b7b5e43d 100644 --- a/tokio/src/io/split.rs +++ b/tokio/src/io/split.rs @@ -150,6 +150,8 @@ impl AsyncWrite for WriteHalf { impl Inner { fn poll_lock(&self, cx: &mut Context<'_>) -> Poll> { + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] if !self.locked.compare_and_swap(false, true, Acquire) { Poll::Ready(Guard { inner: self }) } else { diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 843a1e64beb..aaa01686a32 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -10,7 +10,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(intra_doc_link_resolution_failure)] +#![deny(rustdoc::broken_intra_doc_links)] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) diff --git a/tokio/src/loom/std/mod.rs b/tokio/src/loom/std/mod.rs index e4bae357b5f..9e82a4f4c21 100644 --- a/tokio/src/loom/std/mod.rs +++ b/tokio/src/loom/std/mod.rs @@ -65,8 +65,10 @@ pub(crate) mod sync { pub(crate) use crate::loom::std::atomic_usize::AtomicUsize; pub(crate) use std::sync::atomic::AtomicU8; - pub(crate) use std::sync::atomic::{fence, AtomicPtr}; - pub(crate) use std::sync::atomic::{spin_loop_hint, AtomicBool}; + pub(crate) use std::sync::atomic::{fence, AtomicBool, AtomicPtr}; + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] + pub(crate) use std::sync::atomic::spin_loop_hint; } } diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 18beb1bdbb8..67975781f28 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -154,7 +154,6 @@ macro_rules! cfg_macros { $( #[cfg(feature = "macros")] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] - #[doc(inline)] $item )* } diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index d704347c234..8bbeade6a85 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -402,7 +402,7 @@ impl Command { /// Basic usage: /// /// ```no_run - /// use tokio::process::Command;; + /// use tokio::process::Command; /// use std::process::Stdio; /// /// let command = Command::new("ls") @@ -426,7 +426,7 @@ impl Command { /// Basic usage: /// /// ```no_run - /// use tokio::process::Command;; + /// use tokio::process::Command; /// use std::process::{Stdio}; /// /// let command = Command::new("ls") diff --git a/tokio/src/runtime/thread_pool/queue/local.rs b/tokio/src/runtime/thread_pool/queue/local.rs index e913c4b0e6e..b155128fa3c 100644 --- a/tokio/src/runtime/thread_pool/queue/local.rs +++ b/tokio/src/runtime/thread_pool/queue/local.rs @@ -74,6 +74,8 @@ impl Queue { Err(v) => task = v, } + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } } @@ -107,6 +109,8 @@ impl Queue { // work. This is because all tasks are pushed into the queue from the // current thread (or memory has been acquired if the local queue handle // moved). + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self.head.compare_and_swap(head, head + n, Release); if actual != head { // We failed to claim the tasks, losing the race. Return out of @@ -174,6 +178,8 @@ impl Queue { }); // Attempt to claim the task read above. + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self .head .compare_and_swap(head, head.wrapping_add(1), Release); @@ -182,6 +188,8 @@ impl Queue { return Some(task.assume_init()); } + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } } @@ -244,6 +252,8 @@ impl Queue { } if n > LOCAL_QUEUE_CAPACITY as u32 / 2 { + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] atomic::spin_loop_hint(); // inconsistent, try again continue; @@ -273,6 +283,8 @@ impl Queue { } // Claim all of those tasks! + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self .head .compare_and_swap(src_head, src_head.wrapping_add(n), Release); @@ -282,6 +294,8 @@ impl Queue { return n; } + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } } diff --git a/tokio/src/runtime/thread_pool/worker.rs b/tokio/src/runtime/thread_pool/worker.rs index a4e9d83bed6..4922196155f 100644 --- a/tokio/src/runtime/thread_pool/worker.rs +++ b/tokio/src/runtime/thread_pool/worker.rs @@ -189,6 +189,8 @@ impl Worker { // The lock is only to establish mutual exclusion. Other synchronization // handles memory orderings + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let prev = owned.generation.compare_and_swap( self.generation, self.generation.wrapping_add(1), diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index 515e4e4d101..f17fe95f6a6 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -110,7 +110,10 @@ use crate::loom::cell::CausalCell; use crate::loom::future::AtomicWaker; -use crate::loom::sync::atomic::{spin_loop_hint, AtomicBool, AtomicPtr, AtomicUsize}; +use crate::loom::sync::atomic::{AtomicBool, AtomicPtr, AtomicUsize}; +// TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. +#[allow(deprecated)] +use crate::loom::sync::atomic::spin_loop_hint; use crate::loom::sync::{Arc, Condvar, Mutex}; use std::fmt; @@ -671,6 +674,8 @@ impl Receiver { if !slot.try_rx_lock() { if spin { while !slot.try_rx_lock() { + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] spin_loop_hint(); } } else { diff --git a/tokio/src/sync/mpsc/block.rs b/tokio/src/sync/mpsc/block.rs index 4af990bf45f..ca745aec888 100644 --- a/tokio/src/sync/mpsc/block.rs +++ b/tokio/src/sync/mpsc/block.rs @@ -264,6 +264,8 @@ impl Block { ) -> Result<(), NonNull>> { block.as_mut().start_index = self.start_index.wrapping_add(BLOCK_CAP); + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let next_ptr = self .next .compare_and_swap(ptr::null_mut(), block.as_ptr(), ordering); @@ -308,6 +310,8 @@ impl Block { // // `Release` ensures that the newly allocated block is available to // other threads acquiring the next pointer. + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let next = NonNull::new(self.next.compare_and_swap( ptr::null_mut(), new_block.as_ptr(), diff --git a/tokio/src/sync/mpsc/list.rs b/tokio/src/sync/mpsc/list.rs index 53f82a25ef9..4ae2f405e65 100644 --- a/tokio/src/sync/mpsc/list.rs +++ b/tokio/src/sync/mpsc/list.rs @@ -142,6 +142,8 @@ impl Tx { // // Acquire is not needed as any "actual" value is not accessed. // At this point, the linked list is walked to acquire blocks. + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self.block_tail .compare_and_swap(block_ptr, next_block.as_ptr(), Release); diff --git a/tokio/src/sync/task/atomic_waker.rs b/tokio/src/sync/task/atomic_waker.rs index 127eed35726..84f46bb1db3 100644 --- a/tokio/src/sync/task/atomic_waker.rs +++ b/tokio/src/sync/task/atomic_waker.rs @@ -172,6 +172,8 @@ impl AtomicWaker { where W: WakerRef, { + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] match self.state.compare_and_swap(WAITING, REGISTERING, Acquire) { WAITING => { unsafe { @@ -220,6 +222,8 @@ impl AtomicWaker { waker.wake(); // This is equivalent to a spin lock, so use a spin hint. + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] atomic::spin_loop_hint(); } state => { diff --git a/tokio/src/time/driver/atomic_stack.rs b/tokio/src/time/driver/atomic_stack.rs index 7e5a83fa521..064266954fc 100644 --- a/tokio/src/time/driver/atomic_stack.rs +++ b/tokio/src/time/driver/atomic_stack.rs @@ -60,6 +60,8 @@ impl AtomicStack { *(entry.next_atomic.get()) = curr; } + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self.head.compare_and_swap(curr, ptr, SeqCst); if actual == curr { diff --git a/tokio/src/time/driver/entry.rs b/tokio/src/time/driver/entry.rs index 20cc824019a..0213f5cc318 100644 --- a/tokio/src/time/driver/entry.rs +++ b/tokio/src/time/driver/entry.rs @@ -177,6 +177,8 @@ impl Entry { } let next = ELAPSED | curr; + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self.state.compare_and_swap(curr, next, SeqCst); if curr == actual { @@ -200,6 +202,8 @@ impl Entry { let next = ERROR; + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self.state.compare_and_swap(curr, next, SeqCst); if curr == actual { @@ -288,6 +292,8 @@ impl Entry { notify = true; } + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = entry.state.compare_and_swap(curr, next, SeqCst); if curr == actual { diff --git a/tokio/src/time/driver/mod.rs b/tokio/src/time/driver/mod.rs index b5d91351016..4f48f85faf8 100644 --- a/tokio/src/time/driver/mod.rs +++ b/tokio/src/time/driver/mod.rs @@ -372,6 +372,8 @@ impl Inner { return Err(Error::at_capacity()); } + // TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead. + #[allow(deprecated)] let actual = self.num.compare_and_swap(curr, curr + 1, SeqCst); if curr == actual { diff --git a/tokio/src/time/tests/test_delay.rs b/tokio/src/time/tests/test_delay.rs index 388f9b8b392..8f4924649d9 100644 --- a/tokio/src/time/tests/test_delay.rs +++ b/tokio/src/time/tests/test_delay.rs @@ -1,5 +1,3 @@ -#![warn(rust_2018_idioms)] - use crate::park::{Park, Unpark}; use crate::time::driver::{Driver, Entry, Handle}; use crate::time::Clock; diff --git a/tokio/src/time/throttle.rs b/tokio/src/time/throttle.rs index 435bef63815..d53a6f76211 100644 --- a/tokio/src/time/throttle.rs +++ b/tokio/src/time/throttle.rs @@ -16,7 +16,7 @@ use pin_project_lite::pin_project; /// # Example /// /// Create a throttled stream. -/// ```rust,norun +/// ```rust,no_run /// use std::time::Duration; /// use tokio::stream::StreamExt; /// use tokio::time::throttle; diff --git a/tokio/src/time/wheel/level.rs b/tokio/src/time/wheel/level.rs index 49f9bfb9cf0..d822155c0b0 100644 --- a/tokio/src/time/wheel/level.rs +++ b/tokio/src/time/wheel/level.rs @@ -46,7 +46,7 @@ impl Level { () => { T::default() }; - }; + } Level { level, diff --git a/tokio/tests/support/mock_file.rs b/tokio/tests/support/mock_file.rs index 9895f835e6b..f41f677db63 100644 --- a/tokio/tests/support/mock_file.rs +++ b/tokio/tests/support/mock_file.rs @@ -211,7 +211,7 @@ impl Read for &'_ File { assert!(dst.len() >= data.len()); assert!(dst.len() <= 16 * 1024, "actual = {}", dst.len()); // max buffer - &mut dst[..data.len()].copy_from_slice(&data); + let _ = &mut dst[..data.len()].copy_from_slice(&data); Ok(data.len()) } Some(Read(Err(e))) => Err(e),