From 556e4c5221d566a0072950621149b825b590c189 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Wed, 18 Mar 2026 11:36:00 +0200 Subject: [PATCH 1/5] chore: Do not show "Available on non-loom only." doc label Closes #7976 Uses the unstable #[doc(cfg()]. https://github.com/rust-lang/rust/issues/43781 --- tokio/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index d1e9ba093b7..23bcaadb277 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -15,6 +15,9 @@ no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) ))] +// loom is an internal implementation detail. +// Do not show "Available on non-loom only" label +#![doc(cfg(not(loom)))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, allow(unused_attributes))] #![cfg_attr(loom, allow(dead_code, unreachable_pub))] From e14e0b4197784018c62a3fda8a169a0b10845212 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Wed, 18 Mar 2026 11:51:43 +0200 Subject: [PATCH 2/5] Use build.rs to detect nightly builds --- tokio/Cargo.toml | 2 +- tokio/build.rs | 14 ++++++++++++++ tokio/src/lib.rs | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tokio/build.rs diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index debfc0a047d..b9e913b11d2 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -8,7 +8,7 @@ name = "tokio" # - Create "v1.x.y" git tag. version = "1.50.0" edition = "2021" -rust-version = "1.71" +rust-version = "1.77" authors = ["Tokio Contributors "] license = "MIT" readme = "README.md" diff --git a/tokio/build.rs b/tokio/build.rs new file mode 100644 index 00000000000..c030f71b4a6 --- /dev/null +++ b/tokio/build.rs @@ -0,0 +1,14 @@ +fn main() { + println!("cargo::rustc-check-cfg=cfg(nightly)"); + // Check if we're using nightly + let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string()); + let output = std::process::Command::new(&rustc) + .arg("--version") + .output() + .expect("Failed to get rustc version"); + + let version = String::from_utf8_lossy(&output.stdout); + if version.contains("nightly") { + println!("cargo:rustc-cfg=nightly"); + } +} diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 23bcaadb277..94d848f79e6 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -17,7 +17,7 @@ ))] // loom is an internal implementation detail. // Do not show "Available on non-loom only" label -#![doc(cfg(not(loom)))] +#![cfg_attr(nightly, doc(cfg(not(loom))))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, allow(unused_attributes))] #![cfg_attr(loom, allow(dead_code, unreachable_pub))] From b097f6843f73f90118fe3c4dff22b80dfc2ac4c0 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Wed, 18 Mar 2026 11:54:47 +0200 Subject: [PATCH 3/5] Use `docsrs` instead of `nightly`. Drop build.rs --- tokio/Cargo.toml | 2 +- tokio/build.rs | 14 -------------- tokio/src/lib.rs | 2 +- 3 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 tokio/build.rs diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index b9e913b11d2..debfc0a047d 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -8,7 +8,7 @@ name = "tokio" # - Create "v1.x.y" git tag. version = "1.50.0" edition = "2021" -rust-version = "1.77" +rust-version = "1.71" authors = ["Tokio Contributors "] license = "MIT" readme = "README.md" diff --git a/tokio/build.rs b/tokio/build.rs deleted file mode 100644 index c030f71b4a6..00000000000 --- a/tokio/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - println!("cargo::rustc-check-cfg=cfg(nightly)"); - // Check if we're using nightly - let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string()); - let output = std::process::Command::new(&rustc) - .arg("--version") - .output() - .expect("Failed to get rustc version"); - - let version = String::from_utf8_lossy(&output.stdout); - if version.contains("nightly") { - println!("cargo:rustc-cfg=nightly"); - } -} diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 94d848f79e6..28f073b58a1 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -17,7 +17,7 @@ ))] // loom is an internal implementation detail. // Do not show "Available on non-loom only" label -#![cfg_attr(nightly, doc(cfg(not(loom))))] +#![cfg_attr(docsrs, doc(cfg(not(loom))))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, allow(unused_attributes))] #![cfg_attr(loom, allow(dead_code, unreachable_pub))] From 8f7297c37cabe9f2a62a87727f6ca685c6e4403d Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Wed, 18 Mar 2026 14:34:10 +0200 Subject: [PATCH 4/5] Use doc(auto_cfg(hide(config_name))) --- tokio/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 28f073b58a1..7da7e21fd9c 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -17,7 +17,7 @@ ))] // loom is an internal implementation detail. // Do not show "Available on non-loom only" label -#![cfg_attr(docsrs, doc(cfg(not(loom))))] +#![cfg_attr(docsrs, doc(auto_cfg(hide(loom))))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, allow(unused_attributes))] #![cfg_attr(loom, allow(dead_code, unreachable_pub))] From e29eebebf2f24185d68257ca908c9c082ff937a8 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Wed, 18 Mar 2026 14:45:57 +0200 Subject: [PATCH 5/5] Use same nightly on CirrusCI (FreeBSD) as on Github Actions CI --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2e364028df6..f18d5835468 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ freebsd_instance: image_family: freebsd-14-3 env: RUST_STABLE: stable - RUST_NIGHTLY: nightly-2025-01-25 + RUST_NIGHTLY: nightly-2025-10-12 RUSTFLAGS: -D warnings # This excludes unstable features like io_uring, which require '--cfg tokio_unstable'. TOKIO_STABLE_FEATURES: full,test-util