diff --git a/.cirrus.yml b/.cirrus.yml index 2a93efa39..05f7f82b4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ freebsd_instance: image_family: freebsd-13-1 env: RUST_STABLE: stable - RUST_NIGHTLY: nightly-2022-10-25 + RUST_NIGHTLY: nightly-2023-10-21 RUSTFLAGS: -D warnings # Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44b77ff45..d2d2089b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ env: RUST_BACKTRACE: 1 # Change to specific Rust release to pin rust_stable: stable - rust_nightly: nightly-2023-05-18 + rust_nightly: nightly-2023-10-21 rust_clippy: 1.65.0 # When updating this, also update: # - README.md diff --git a/tokio-macros/Cargo.toml b/tokio-macros/Cargo.toml index a0289313a..3596c22b7 100644 --- a/tokio-macros/Cargo.toml +++ b/tokio-macros/Cargo.toml @@ -22,7 +22,7 @@ proc-macro = true [features] [dependencies] -proc-macro2 = "1.0.7" +proc-macro2 = "1.0.60" quote = "1" syn = { version = "2.0", features = ["full"] } diff --git a/tokio-stream/src/stream_ext.rs b/tokio-stream/src/stream_ext.rs index 8b457b87b..166c31a61 100644 --- a/tokio-stream/src/stream_ext.rs +++ b/tokio-stream/src/stream_ext.rs @@ -848,8 +848,7 @@ pub trait StreamExt: Stream { /// /// `collect` streams all values, awaiting as needed. Values are pushed into /// a collection. A number of different target collection types are - /// supported, including [`Vec`](std::vec::Vec), - /// [`String`](std::string::String), and [`Bytes`]. + /// supported, including [`Vec`], [`String`], and [`Bytes`]. /// /// [`Bytes`]: https://docs.rs/bytes/0.6.0/bytes/struct.Bytes.html /// @@ -1005,9 +1004,8 @@ pub trait StreamExt: Stream { /// Applies a per-item timeout to the passed stream. /// - /// `timeout_repeating()` takes an [`Interval`](tokio::time::Interval) that - /// controls the time each element of the stream has to complete before - /// timing out. + /// `timeout_repeating()` takes an [`Interval`] that controls the time each + /// element of the stream has to complete before timing out. /// /// If the wrapped stream yields a value before the deadline is reached, the /// value is returned. Otherwise, an error is returned. The caller may decide diff --git a/tokio-stream/src/stream_ext/collect.rs b/tokio-stream/src/stream_ext/collect.rs index 8548b7455..60b94d3fd 100644 --- a/tokio-stream/src/stream_ext/collect.rs +++ b/tokio-stream/src/stream_ext/collect.rs @@ -26,7 +26,7 @@ pin_project! { } } -/// Convert from a [`Stream`](crate::Stream). +/// Convert from a [`Stream`]. /// /// This trait is not intended to be used directly. Instead, call /// [`StreamExt::collect()`](super::StreamExt::collect). diff --git a/tokio-util/src/io/stream_reader.rs b/tokio-util/src/io/stream_reader.rs index d30f7f0f4..6ecf8ec98 100644 --- a/tokio-util/src/io/stream_reader.rs +++ b/tokio-util/src/io/stream_reader.rs @@ -166,7 +166,7 @@ where B: Buf, E: Into, { - /// Convert a stream of byte chunks into an [`AsyncRead`](tokio::io::AsyncRead). + /// Convert a stream of byte chunks into an [`AsyncRead`]. /// /// The item should be a [`Result`] with the ok variant being something that /// implements the [`Buf`] trait (e.g. `Vec` or `Bytes`). The error diff --git a/tokio/src/fs/canonicalize.rs b/tokio/src/fs/canonicalize.rs index 403662685..42bc9d1d5 100644 --- a/tokio/src/fs/canonicalize.rs +++ b/tokio/src/fs/canonicalize.rs @@ -6,9 +6,7 @@ use std::path::{Path, PathBuf}; /// Returns the canonical, absolute form of a path with all intermediate /// components normalized and symbolic links resolved. /// -/// This is an async version of [`std::fs::canonicalize`][std] -/// -/// [std]: std::fs::canonicalize +/// This is an async version of [`std::fs::canonicalize`]. /// /// # Platform-specific behavior /// diff --git a/tokio/src/fs/copy.rs b/tokio/src/fs/copy.rs index b47f28728..c686e5fdd 100644 --- a/tokio/src/fs/copy.rs +++ b/tokio/src/fs/copy.rs @@ -5,9 +5,7 @@ use std::path::Path; /// of the original file to the destination file. /// This function will overwrite the contents of to. /// -/// This is the async equivalent of [`std::fs::copy`][std]. -/// -/// [std]: fn@std::fs::copy +/// This is the async equivalent of [`std::fs::copy`]. /// /// # Examples /// diff --git a/tokio/src/fs/create_dir.rs b/tokio/src/fs/create_dir.rs index 411969500..dbc97eb60 100644 --- a/tokio/src/fs/create_dir.rs +++ b/tokio/src/fs/create_dir.rs @@ -5,9 +5,7 @@ use std::path::Path; /// Creates a new, empty directory at the provided path. /// -/// This is an async version of [`std::fs::create_dir`][std] -/// -/// [std]: std::fs::create_dir +/// This is an async version of [`std::fs::create_dir`]. /// /// # Platform-specific behavior /// diff --git a/tokio/src/fs/create_dir_all.rs b/tokio/src/fs/create_dir_all.rs index 21f0c82d1..0a85b6a0c 100644 --- a/tokio/src/fs/create_dir_all.rs +++ b/tokio/src/fs/create_dir_all.rs @@ -6,9 +6,7 @@ use std::path::Path; /// Recursively creates a directory and all of its parent components if they /// are missing. /// -/// This is an async version of [`std::fs::create_dir_all`][std] -/// -/// [std]: std::fs::create_dir_all +/// This is an async version of [`std::fs::create_dir_all`]. /// /// # Platform-specific behavior /// diff --git a/tokio/src/fs/dir_builder.rs b/tokio/src/fs/dir_builder.rs index b2210fe25..3d822008f 100644 --- a/tokio/src/fs/dir_builder.rs +++ b/tokio/src/fs/dir_builder.rs @@ -7,8 +7,6 @@ use std::path::Path; /// /// This is a specialized version of [`std::fs::DirBuilder`] for usage on /// the Tokio runtime. -/// -/// [std::fs::DirBuilder]: std::fs::DirBuilder #[derive(Debug, Default)] pub struct DirBuilder { /// Indicates whether to create parent directories if they are missing. @@ -23,9 +21,7 @@ impl DirBuilder { /// Creates a new set of options with default mode/security settings for all /// platforms and also non-recursive. /// - /// This is an async version of [`std::fs::DirBuilder::new`][std] - /// - /// [std]: std::fs::DirBuilder::new + /// This is an async version of [`std::fs::DirBuilder::new`]. /// /// # Examples /// @@ -43,9 +39,7 @@ impl DirBuilder { /// /// This option defaults to `false`. /// - /// This is an async version of [`std::fs::DirBuilder::recursive`][std] - /// - /// [std]: std::fs::DirBuilder::recursive + /// This is an async version of [`std::fs::DirBuilder::recursive`]. /// /// # Examples /// @@ -65,9 +59,7 @@ impl DirBuilder { /// It is considered an error if the directory already exists unless /// recursive mode is enabled. /// - /// This is an async version of [`std::fs::DirBuilder::create`][std] - /// - /// [std]: std::fs::DirBuilder::create + /// This is an async version of [`std::fs::DirBuilder::create`]. /// /// # Errors /// diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs index be2d48c27..033b2982c 100644 --- a/tokio/src/fs/file.rs +++ b/tokio/src/fs/file.rs @@ -32,7 +32,7 @@ use std::fs::File as StdFile; /// A reference to an open file on the filesystem. /// -/// This is a specialized version of [`std::fs::File`][std] for usage from the +/// This is a specialized version of [`std::fs::File`] for usage from the /// Tokio runtime. /// /// An instance of a `File` can be read and/or written depending on what options @@ -50,7 +50,6 @@ use std::fs::File as StdFile; /// Reading and writing to a `File` is usually done using the convenience /// methods found on the [`AsyncReadExt`] and [`AsyncWriteExt`] traits. /// -/// [std]: struct@std::fs::File /// [`AsyncSeek`]: trait@crate::io::AsyncSeek /// [`flush`]: fn@crate::io::AsyncWriteExt::flush /// [`sync_all`]: fn@crate::fs::File::sync_all @@ -224,10 +223,7 @@ impl File { OpenOptions::new() } - /// Converts a [`std::fs::File`][std] to a [`tokio::fs::File`][file]. - /// - /// [std]: std::fs::File - /// [file]: File + /// Converts a [`std::fs::File`] to a [`tokio::fs::File`](File). /// /// # Examples /// @@ -430,13 +426,11 @@ impl File { Ok(File::from_std(std_file)) } - /// Destructures `File` into a [`std::fs::File`][std]. This function is + /// Destructures `File` into a [`std::fs::File`]. This function is /// async to allow any in-flight operations to complete. /// /// Use `File::try_into_std` to attempt conversion immediately. /// - /// [std]: std::fs::File - /// /// # Examples /// /// ```no_run @@ -453,9 +447,7 @@ impl File { Arc::try_unwrap(self.std).expect("Arc::try_unwrap failed") } - /// Tries to immediately destructure `File` into a [`std::fs::File`][std]. - /// - /// [std]: std::fs::File + /// Tries to immediately destructure `File` into a [`std::fs::File`]. /// /// # Errors /// diff --git a/tokio/src/fs/hard_link.rs b/tokio/src/fs/hard_link.rs index 50cc17d28..7f4e1c5fd 100644 --- a/tokio/src/fs/hard_link.rs +++ b/tokio/src/fs/hard_link.rs @@ -5,9 +5,7 @@ use std::path::Path; /// Creates a new hard link on the filesystem. /// -/// This is an async version of [`std::fs::hard_link`][std] -/// -/// [std]: std::fs::hard_link +/// This is an async version of [`std::fs::hard_link`]. /// /// The `dst` path will be a link pointing to the `src` path. Note that systems /// often require these two paths to both be located on the same filesystem. diff --git a/tokio/src/fs/metadata.rs b/tokio/src/fs/metadata.rs index ff9cded79..21ebe4f78 100644 --- a/tokio/src/fs/metadata.rs +++ b/tokio/src/fs/metadata.rs @@ -7,7 +7,7 @@ use std::path::Path; /// Given a path, queries the file system to get information about a file, /// directory, etc. /// -/// This is an async version of [`std::fs::metadata`][std] +/// This is an async version of [`std::fs::metadata`]. /// /// This function will traverse symbolic links to query information about the /// destination file. @@ -18,7 +18,6 @@ use std::path::Path; /// `GetFileAttributesEx` function on Windows. Note that, this [may change in /// the future][changes]. /// -/// [std]: std::fs::metadata /// [changes]: https://doc.rust-lang.org/std/io/index.html#platform-specific-behavior /// /// # Errors diff --git a/tokio/src/fs/open_options.rs b/tokio/src/fs/open_options.rs index 103510250..6e2aa0cdf 100644 --- a/tokio/src/fs/open_options.rs +++ b/tokio/src/fs/open_options.rs @@ -25,7 +25,7 @@ use std::os::windows::fs::OpenOptionsExt; /// Generally speaking, when using `OpenOptions`, you'll first call [`new`], /// then chain calls to methods to set each option, then call [`open`], passing /// the path of the file you're trying to open. This will give you a -/// [`io::Result`][result] with a [`File`] inside that you can further operate +/// [`io::Result`] with a [`File`] inside that you can further operate /// on. /// /// This is a specialized version of [`std::fs::OpenOptions`] for usage from @@ -36,11 +36,9 @@ use std::os::windows::fs::OpenOptionsExt; /// /// [`new`]: OpenOptions::new /// [`open`]: OpenOptions::open -/// [result]: std::io::Result /// [`File`]: File /// [`File::open`]: File::open /// [`File::create`]: File::create -/// [`std::fs::OpenOptions`]: std::fs::OpenOptions /// /// # Examples /// diff --git a/tokio/src/fs/read.rs b/tokio/src/fs/read.rs index ada5ba391..36edf2a5b 100644 --- a/tokio/src/fs/read.rs +++ b/tokio/src/fs/read.rs @@ -4,9 +4,7 @@ use std::{io, path::Path}; /// Reads the entire contents of a file into a bytes vector. /// -/// This is an async version of [`std::fs::read`][std] -/// -/// [std]: std::fs::read +/// This is an async version of [`std::fs::read`]. /// /// This is a convenience function for using [`File::open`] and [`read_to_end`] /// with fewer imports and without an intermediate variable. It pre-allocates a diff --git a/tokio/src/fs/read_dir.rs b/tokio/src/fs/read_dir.rs index 9e509792e..20d74967c 100644 --- a/tokio/src/fs/read_dir.rs +++ b/tokio/src/fs/read_dir.rs @@ -24,7 +24,7 @@ const CHUNK_SIZE: usize = 32; /// Returns a stream over the entries within a directory. /// -/// This is an async version of [`std::fs::read_dir`](std::fs::read_dir) +/// This is an async version of [`std::fs::read_dir`]. /// /// This operation is implemented by running the equivalent blocking /// operation on a separate thread pool using [`spawn_blocking`]. diff --git a/tokio/src/fs/read_link.rs b/tokio/src/fs/read_link.rs index 6c48c5e15..f3d5e99f9 100644 --- a/tokio/src/fs/read_link.rs +++ b/tokio/src/fs/read_link.rs @@ -5,9 +5,7 @@ use std::path::{Path, PathBuf}; /// Reads a symbolic link, returning the file that the link points to. /// -/// This is an async version of [`std::fs::read_link`][std] -/// -/// [std]: std::fs::read_link +/// This is an async version of [`std::fs::read_link`]. pub async fn read_link(path: impl AsRef) -> io::Result { let path = path.as_ref().to_owned(); asyncify(move || std::fs::read_link(path)).await diff --git a/tokio/src/fs/remove_dir.rs b/tokio/src/fs/remove_dir.rs index 6e7cbd08f..5407af0dd 100644 --- a/tokio/src/fs/remove_dir.rs +++ b/tokio/src/fs/remove_dir.rs @@ -5,7 +5,7 @@ use std::path::Path; /// Removes an existing, empty directory. /// -/// This is an async version of [`std::fs::remove_dir`](std::fs::remove_dir) +/// This is an async version of [`std::fs::remove_dir`]. pub async fn remove_dir(path: impl AsRef) -> io::Result<()> { let path = path.as_ref().to_owned(); asyncify(move || std::fs::remove_dir(path)).await diff --git a/tokio/src/fs/remove_file.rs b/tokio/src/fs/remove_file.rs index d22a5bfc8..401880254 100644 --- a/tokio/src/fs/remove_file.rs +++ b/tokio/src/fs/remove_file.rs @@ -9,9 +9,7 @@ use std::path::Path; /// depending on platform, other open file descriptors may prevent immediate /// removal). /// -/// This is an async version of [`std::fs::remove_file`][std] -/// -/// [std]: std::fs::remove_file +/// This is an async version of [`std::fs::remove_file`]. pub async fn remove_file(path: impl AsRef) -> io::Result<()> { let path = path.as_ref().to_owned(); asyncify(move || std::fs::remove_file(path)).await diff --git a/tokio/src/fs/rename.rs b/tokio/src/fs/rename.rs index 4f980821d..41647dafc 100644 --- a/tokio/src/fs/rename.rs +++ b/tokio/src/fs/rename.rs @@ -8,7 +8,7 @@ use std::path::Path; /// /// This will not work if the new name is on a different mount point. /// -/// This is an async version of [`std::fs::rename`](std::fs::rename) +/// This is an async version of [`std::fs::rename`]. pub async fn rename(from: impl AsRef, to: impl AsRef) -> io::Result<()> { let from = from.as_ref().to_owned(); let to = to.as_ref().to_owned(); diff --git a/tokio/src/fs/symlink.rs b/tokio/src/fs/symlink.rs index 22ece7250..246e17e26 100644 --- a/tokio/src/fs/symlink.rs +++ b/tokio/src/fs/symlink.rs @@ -7,9 +7,7 @@ use std::path::Path; /// /// The `dst` path will be a symbolic link pointing to the `src` path. /// -/// This is an async version of [`std::os::unix::fs::symlink`][std] -/// -/// [std]: std::os::unix::fs::symlink +/// This is an async version of [`std::os::unix::fs::symlink`]. pub async fn symlink(src: impl AsRef, dst: impl AsRef) -> io::Result<()> { let src = src.as_ref().to_owned(); let dst = dst.as_ref().to_owned(); diff --git a/tokio/src/runtime/task/mod.rs b/tokio/src/runtime/task/mod.rs index ff1a455df..d7fde0fe6 100644 --- a/tokio/src/runtime/task/mod.rs +++ b/tokio/src/runtime/task/mod.rs @@ -179,7 +179,7 @@ mod harness; use self::harness::Harness; mod id; -#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))] +#[cfg_attr(not(tokio_unstable), allow(unreachable_pub, unused_imports))] pub use id::{id, try_id, Id}; #[cfg(feature = "rt")] diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index 5024e8391..4aa8b6377 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -13,7 +13,7 @@ use std::task::{Context, Poll}; /// Sends values to the associated `Receiver`. /// -/// Instances are created by the [`channel`](channel) function. +/// Instances are created by the [`channel`] function. /// /// To convert the `Sender` into a `Sink` or use it in a poll function, you can /// use the [`PollSender`] utility. @@ -86,7 +86,7 @@ pub struct OwnedPermit { /// Receives values from the associated `Sender`. /// -/// Instances are created by the [`channel`](channel) function. +/// Instances are created by the [`channel`] function. /// /// This receiver can be turned into a `Stream` using [`ReceiverStream`]. /// diff --git a/tokio/src/sync/mpsc/unbounded.rs b/tokio/src/sync/mpsc/unbounded.rs index 81d3f701b..d996b8564 100644 --- a/tokio/src/sync/mpsc/unbounded.rs +++ b/tokio/src/sync/mpsc/unbounded.rs @@ -7,8 +7,7 @@ use std::task::{Context, Poll}; /// Send values to the associated `UnboundedReceiver`. /// -/// Instances are created by the -/// [`unbounded_channel`](unbounded_channel) function. +/// Instances are created by the [`unbounded_channel`] function. pub struct UnboundedSender { chan: chan::Tx, } @@ -65,8 +64,7 @@ impl fmt::Debug for UnboundedSender { /// Receive values from the associated `UnboundedSender`. /// -/// Instances are created by the -/// [`unbounded_channel`](unbounded_channel) function. +/// Instances are created by the [`unbounded_channel`] function. /// /// This receiver can be turned into a `Stream` using [`UnboundedReceiverStream`]. ///