]> git.feebdaed.xyz Git - 0xmirror/tokio.git/commitdiff
tokio: raise MSRV to 1.71 (#7658)
authorAlice Ryhl <aliceryhl@google.com>
Thu, 2 Oct 2025 09:14:17 +0000 (11:14 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Oct 2025 09:14:17 +0000 (11:14 +0200)
.github/workflows/ci.yml
README.md
tokio-macros/Cargo.toml
tokio-stream/Cargo.toml
tokio-stream/src/stream_map.rs
tokio-test/Cargo.toml
tokio-util/Cargo.toml
tokio-util/src/task/join_map.rs
tokio/Cargo.toml
tokio/README.md
tokio/src/loom/std/mod.rs

index 8d028574ed1c1ca2b7478eb3b27433295f1515e5..7c6d59ef5fdb66c7cb02448810053279a907469c 100644 (file)
@@ -28,7 +28,7 @@ env:
   # - tokio-util/Cargo.toml
   # - tokio-test/Cargo.toml
   # - tokio-stream/Cargo.toml
-  rust_min: '1.70'
+  rust_min: '1.71'
   # This excludes unstable features like io_uring,
   # which require '--cfg tokio_unstable'.
   TOKIO_STABLE_FEATURES: "full,test-util"
index 902b3c9cd438117683ee9a7398c659ade3564cb3..6a1bdbaf1a3516ccb0c991ee5423fc649bf3a3e1 100644 (file)
--- a/README.md
+++ b/README.md
@@ -186,12 +186,13 @@ When updating this, also update:
 
 Tokio will keep a rolling MSRV (minimum supported rust version) policy of **at
 least** 6 months. When increasing the MSRV, the new Rust version must have been
-released at least six months ago. The current MSRV is 1.70.
+released at least six months ago. The current MSRV is 1.71.
 
 Note that the MSRV is not increased automatically, and only as part of a minor
 release. The MSRV history for past minor releases can be found below:
 
- * 1.39 to now  - Rust 1.70
+ * 1.48 to now  - Rust 1.71
+ * 1.39 to 1.47 - Rust 1.70
  * 1.30 to 1.38 - Rust 1.63
  * 1.27 to 1.29 - Rust 1.56
  * 1.17 to 1.26 - Rust 1.49
index 4f4a5086e43ff54b3879fa16a07f9a631f225f34..76a7d4ae57aa4f0df6a9ecb076491e2cce040361 100644 (file)
@@ -6,7 +6,7 @@ name = "tokio-macros"
 # - Create "tokio-macros-x.y.z" git tag.
 version = "2.5.0"
 edition = "2021"
-rust-version = "1.70"
+rust-version = "1.71"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
index 547d7f5deaf13a8a594da9b982b98fe844e2fec9..534601b0b24c2310bd6c5de233188c9dd1a3154f 100644 (file)
@@ -6,7 +6,7 @@ name = "tokio-stream"
 # - Create "tokio-stream-0.1.x" git tag.
 version = "0.1.17"
 edition = "2021"
-rust-version = "1.70"
+rust-version = "1.71"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
index 49ccc9268110ca450f0618b62408152424472e79..1892e9b35bf27541c2d247246b7a0b96323a260a 100644 (file)
@@ -734,22 +734,15 @@ mod rand {
         #[cfg(not(loom))]
         pub(crate) mod rand {
             use std::collections::hash_map::RandomState;
-            use std::hash::{BuildHasher, Hash, Hasher};
+            use std::hash::BuildHasher;
             use std::sync::atomic::AtomicU32;
             use std::sync::atomic::Ordering::Relaxed;
 
             static COUNTER: AtomicU32 = AtomicU32::new(1);
 
             pub(crate) fn seed() -> u64 {
-                let rand_state = RandomState::new();
-
-                let mut hasher = rand_state.build_hasher();
-
                 // Hash some unique-ish data to generate some new state
-                COUNTER.fetch_add(1, Relaxed).hash(&mut hasher);
-
-                // Get the seed
-                hasher.finish()
+                RandomState::new().hash_one(COUNTER.fetch_add(1, Relaxed))
             }
         }
 
index 5601a112205b72f8ad6ebf4fc8c58e0e8490163e..a3dcef06d6c598e85ab80e5ae03075cb5d05aff5 100644 (file)
@@ -6,7 +6,7 @@ name = "tokio-test"
 # - Create "tokio-test-0.4.x" git tag.
 version = "0.4.4"
 edition = "2021"
-rust-version = "1.70"
+rust-version = "1.71"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
index 29ea79ef726913c637b5800b0aae36a8d2e41394..1f0b1742239ee32bc943ad241d233f442cd38969 100644 (file)
@@ -6,7 +6,7 @@ name = "tokio-util"
 # - Create "tokio-util-0.7.x" git tag.
 version = "0.7.16"
 edition = "2021"
-rust-version = "1.70"
+rust-version = "1.71"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
index 3a5eccdca269f32844c8e0633fedc40d83cebb07..8a6143eca704e4cd86fc28a733faa69f93d748a8 100644 (file)
@@ -4,7 +4,7 @@ use std::borrow::Borrow;
 use std::collections::hash_map::RandomState;
 use std::fmt;
 use std::future::Future;
-use std::hash::{BuildHasher, Hash, Hasher};
+use std::hash::{BuildHasher, Hash};
 use std::marker::PhantomData;
 use tokio::runtime::Handle;
 use tokio::task::{AbortHandle, Id, JoinError, JoinSet, LocalSet};
@@ -391,13 +391,13 @@ where
 
     fn insert(&mut self, mut key: K, mut abort: AbortHandle) {
         let hash_builder = self.hashes_by_task.hasher();
-        let hash = hash_one(hash_builder, &key);
+        let hash = hash_builder.hash_one(&key);
         let id = abort.id();
 
         // Insert the new key into the map of tasks by keys.
         let entry =
             self.tasks_by_key
-                .entry(hash, |(k, _)| *k == key, |(k, _)| hash_one(hash_builder, k));
+                .entry(hash, |(k, _)| *k == key, |(k, _)| hash_builder.hash_one(k));
         match entry {
             Entry::Occupied(occ) => {
                 // There was a previous task spawned with the same key! Cancel
@@ -673,9 +673,9 @@ where
     /// ```
     #[inline]
     pub fn reserve(&mut self, additional: usize) {
-        let hash_builder = self.hashes_by_task.hasher();
-        self.tasks_by_key
-            .reserve(additional, |(k, _)| hash_one(hash_builder, k));
+        self.tasks_by_key.reserve(additional, |(k, _)| {
+            self.hashes_by_task.hasher().hash_one(k)
+        });
         self.hashes_by_task.reserve(additional);
     }
 
@@ -701,9 +701,8 @@ where
     #[inline]
     pub fn shrink_to_fit(&mut self) {
         self.hashes_by_task.shrink_to_fit();
-        let hash_builder = self.hashes_by_task.hasher();
         self.tasks_by_key
-            .shrink_to_fit(|(k, _)| hash_one(hash_builder, k));
+            .shrink_to_fit(|(k, _)| self.hashes_by_task.hasher().hash_one(k));
     }
 
     /// Shrinks the capacity of the map with a lower limit. It will drop
@@ -732,9 +731,9 @@ where
     #[inline]
     pub fn shrink_to(&mut self, min_capacity: usize) {
         self.hashes_by_task.shrink_to(min_capacity);
-        let hash_builder = self.hashes_by_task.hasher();
-        self.tasks_by_key
-            .shrink_to(min_capacity, |(k, _)| hash_one(hash_builder, k))
+        self.tasks_by_key.shrink_to(min_capacity, |(k, _)| {
+            self.hashes_by_task.hasher().hash_one(k)
+        })
     }
 
     /// Look up a task in the map by its key, returning the key and abort handle.
@@ -743,8 +742,7 @@ where
         Q: ?Sized + Hash + Eq,
         K: Borrow<Q>,
     {
-        let hash_builder = self.hashes_by_task.hasher();
-        let hash = hash_one(hash_builder, key);
+        let hash = self.hashes_by_task.hasher().hash_one(key);
         self.tasks_by_key.find(hash, |(k, _)| k.borrow() == key)
     }
 
@@ -765,18 +763,6 @@ where
     }
 }
 
-/// Returns the hash for a given key.
-#[inline]
-fn hash_one<S, Q>(hash_builder: &S, key: &Q) -> u64
-where
-    Q: ?Sized + Hash,
-    S: BuildHasher,
-{
-    let mut hasher = hash_builder.build_hasher();
-    key.hash(&mut hasher);
-    hasher.finish()
-}
-
 impl<K, V, S> JoinMap<K, V, S>
 where
     V: 'static,
index 01daacd9864311705b1594e5aeb741ea5ea7b80f..90347640021110f105e0fcc1abeb332ca8f2f514 100644 (file)
@@ -8,7 +8,7 @@ name = "tokio"
 # - Create "v1.x.y" git tag.
 version = "1.47.1"
 edition = "2021"
-rust-version = "1.70"
+rust-version = "1.71"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 readme = "README.md"
index 902b3c9cd438117683ee9a7398c659ade3564cb3..6a1bdbaf1a3516ccb0c991ee5423fc649bf3a3e1 100644 (file)
@@ -186,12 +186,13 @@ When updating this, also update:
 
 Tokio will keep a rolling MSRV (minimum supported rust version) policy of **at
 least** 6 months. When increasing the MSRV, the new Rust version must have been
-released at least six months ago. The current MSRV is 1.70.
+released at least six months ago. The current MSRV is 1.71.
 
 Note that the MSRV is not increased automatically, and only as part of a minor
 release. The MSRV history for past minor releases can be found below:
 
- * 1.39 to now  - Rust 1.70
+ * 1.48 to now  - Rust 1.71
+ * 1.39 to 1.47 - Rust 1.70
  * 1.30 to 1.38 - Rust 1.63
  * 1.27 to 1.29 - Rust 1.56
  * 1.17 to 1.26 - Rust 1.49
index 14e552a9aa597a96882cf664601154e91f1af4f8..d3556c953cd363216afefa6b88492bb4f5de4d98 100644 (file)
@@ -39,14 +39,8 @@ pub(crate) mod rand {
 
     pub(crate) fn seed() -> u64 {
         let rand_state = RandomState::new();
-
-        let mut hasher = rand_state.build_hasher();
-
         // Hash some unique-ish data to generate some new state
-        COUNTER.fetch_add(1, Relaxed).hash(&mut hasher);
-
-        // Get the seed
-        hasher.finish()
+        rand_state.hash_one(COUNTER.fetch_add(1, Relaxed))
     }
 }