Skip to content

Commit 5b4cbbc

Browse files
authored
tokio: raise MSRV to 1.71 (#7658)
1 parent c1f0c76 commit 5b4cbbc

File tree

11 files changed

+26
-51
lines changed

11 files changed

+26
-51
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ env:
2828
# - tokio-util/Cargo.toml
2929
# - tokio-test/Cargo.toml
3030
# - tokio-stream/Cargo.toml
31-
rust_min: '1.70'
31+
rust_min: '1.71'
3232
# This excludes unstable features like io_uring,
3333
# which require '--cfg tokio_unstable'.
3434
TOKIO_STABLE_FEATURES: "full,test-util"

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,13 @@ When updating this, also update:
186186

187187
Tokio will keep a rolling MSRV (minimum supported rust version) policy of **at
188188
least** 6 months. When increasing the MSRV, the new Rust version must have been
189-
released at least six months ago. The current MSRV is 1.70.
189+
released at least six months ago. The current MSRV is 1.71.
190190

191191
Note that the MSRV is not increased automatically, and only as part of a minor
192192
release. The MSRV history for past minor releases can be found below:
193193

194-
* 1.39 to now - Rust 1.70
194+
* 1.48 to now - Rust 1.71
195+
* 1.39 to 1.47 - Rust 1.70
195196
* 1.30 to 1.38 - Rust 1.63
196197
* 1.27 to 1.29 - Rust 1.56
197198
* 1.17 to 1.26 - Rust 1.49

tokio-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "tokio-macros"
66
# - Create "tokio-macros-x.y.z" git tag.
77
version = "2.5.0"
88
edition = "2021"
9-
rust-version = "1.70"
9+
rust-version = "1.71"
1010
authors = ["Tokio Contributors <[email protected]>"]
1111
license = "MIT"
1212
repository = "https://github.com/tokio-rs/tokio"

tokio-stream/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "tokio-stream"
66
# - Create "tokio-stream-0.1.x" git tag.
77
version = "0.1.17"
88
edition = "2021"
9-
rust-version = "1.70"
9+
rust-version = "1.71"
1010
authors = ["Tokio Contributors <[email protected]>"]
1111
license = "MIT"
1212
repository = "https://github.com/tokio-rs/tokio"

tokio-stream/src/stream_map.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -734,22 +734,15 @@ mod rand {
734734
#[cfg(not(loom))]
735735
pub(crate) mod rand {
736736
use std::collections::hash_map::RandomState;
737-
use std::hash::{BuildHasher, Hash, Hasher};
737+
use std::hash::BuildHasher;
738738
use std::sync::atomic::AtomicU32;
739739
use std::sync::atomic::Ordering::Relaxed;
740740

741741
static COUNTER: AtomicU32 = AtomicU32::new(1);
742742

743743
pub(crate) fn seed() -> u64 {
744-
let rand_state = RandomState::new();
745-
746-
let mut hasher = rand_state.build_hasher();
747-
748744
// Hash some unique-ish data to generate some new state
749-
COUNTER.fetch_add(1, Relaxed).hash(&mut hasher);
750-
751-
// Get the seed
752-
hasher.finish()
745+
RandomState::new().hash_one(COUNTER.fetch_add(1, Relaxed))
753746
}
754747
}
755748

tokio-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "tokio-test"
66
# - Create "tokio-test-0.4.x" git tag.
77
version = "0.4.4"
88
edition = "2021"
9-
rust-version = "1.70"
9+
rust-version = "1.71"
1010
authors = ["Tokio Contributors <[email protected]>"]
1111
license = "MIT"
1212
repository = "https://github.com/tokio-rs/tokio"

tokio-util/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "tokio-util"
66
# - Create "tokio-util-0.7.x" git tag.
77
version = "0.7.16"
88
edition = "2021"
9-
rust-version = "1.70"
9+
rust-version = "1.71"
1010
authors = ["Tokio Contributors <[email protected]>"]
1111
license = "MIT"
1212
repository = "https://github.com/tokio-rs/tokio"

tokio-util/src/task/join_map.rs

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::borrow::Borrow;
44
use std::collections::hash_map::RandomState;
55
use std::fmt;
66
use std::future::Future;
7-
use std::hash::{BuildHasher, Hash, Hasher};
7+
use std::hash::{BuildHasher, Hash};
88
use std::marker::PhantomData;
99
use tokio::runtime::Handle;
1010
use tokio::task::{AbortHandle, Id, JoinError, JoinSet, LocalSet};
@@ -391,13 +391,13 @@ where
391391

392392
fn insert(&mut self, mut key: K, mut abort: AbortHandle) {
393393
let hash_builder = self.hashes_by_task.hasher();
394-
let hash = hash_one(hash_builder, &key);
394+
let hash = hash_builder.hash_one(&key);
395395
let id = abort.id();
396396

397397
// Insert the new key into the map of tasks by keys.
398398
let entry =
399399
self.tasks_by_key
400-
.entry(hash, |(k, _)| *k == key, |(k, _)| hash_one(hash_builder, k));
400+
.entry(hash, |(k, _)| *k == key, |(k, _)| hash_builder.hash_one(k));
401401
match entry {
402402
Entry::Occupied(occ) => {
403403
// There was a previous task spawned with the same key! Cancel
@@ -673,9 +673,9 @@ where
673673
/// ```
674674
#[inline]
675675
pub fn reserve(&mut self, additional: usize) {
676-
let hash_builder = self.hashes_by_task.hasher();
677-
self.tasks_by_key
678-
.reserve(additional, |(k, _)| hash_one(hash_builder, k));
676+
self.tasks_by_key.reserve(additional, |(k, _)| {
677+
self.hashes_by_task.hasher().hash_one(k)
678+
});
679679
self.hashes_by_task.reserve(additional);
680680
}
681681

@@ -701,9 +701,8 @@ where
701701
#[inline]
702702
pub fn shrink_to_fit(&mut self) {
703703
self.hashes_by_task.shrink_to_fit();
704-
let hash_builder = self.hashes_by_task.hasher();
705704
self.tasks_by_key
706-
.shrink_to_fit(|(k, _)| hash_one(hash_builder, k));
705+
.shrink_to_fit(|(k, _)| self.hashes_by_task.hasher().hash_one(k));
707706
}
708707

709708
/// Shrinks the capacity of the map with a lower limit. It will drop
@@ -732,9 +731,9 @@ where
732731
#[inline]
733732
pub fn shrink_to(&mut self, min_capacity: usize) {
734733
self.hashes_by_task.shrink_to(min_capacity);
735-
let hash_builder = self.hashes_by_task.hasher();
736-
self.tasks_by_key
737-
.shrink_to(min_capacity, |(k, _)| hash_one(hash_builder, k))
734+
self.tasks_by_key.shrink_to(min_capacity, |(k, _)| {
735+
self.hashes_by_task.hasher().hash_one(k)
736+
})
738737
}
739738

740739
/// Look up a task in the map by its key, returning the key and abort handle.
@@ -743,8 +742,7 @@ where
743742
Q: ?Sized + Hash + Eq,
744743
K: Borrow<Q>,
745744
{
746-
let hash_builder = self.hashes_by_task.hasher();
747-
let hash = hash_one(hash_builder, key);
745+
let hash = self.hashes_by_task.hasher().hash_one(key);
748746
self.tasks_by_key.find(hash, |(k, _)| k.borrow() == key)
749747
}
750748

@@ -765,18 +763,6 @@ where
765763
}
766764
}
767765

768-
/// Returns the hash for a given key.
769-
#[inline]
770-
fn hash_one<S, Q>(hash_builder: &S, key: &Q) -> u64
771-
where
772-
Q: ?Sized + Hash,
773-
S: BuildHasher,
774-
{
775-
let mut hasher = hash_builder.build_hasher();
776-
key.hash(&mut hasher);
777-
hasher.finish()
778-
}
779-
780766
impl<K, V, S> JoinMap<K, V, S>
781767
where
782768
V: 'static,

tokio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name = "tokio"
88
# - Create "v1.x.y" git tag.
99
version = "1.47.1"
1010
edition = "2021"
11-
rust-version = "1.70"
11+
rust-version = "1.71"
1212
authors = ["Tokio Contributors <[email protected]>"]
1313
license = "MIT"
1414
readme = "README.md"

tokio/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,13 @@ When updating this, also update:
186186

187187
Tokio will keep a rolling MSRV (minimum supported rust version) policy of **at
188188
least** 6 months. When increasing the MSRV, the new Rust version must have been
189-
released at least six months ago. The current MSRV is 1.70.
189+
released at least six months ago. The current MSRV is 1.71.
190190

191191
Note that the MSRV is not increased automatically, and only as part of a minor
192192
release. The MSRV history for past minor releases can be found below:
193193

194-
* 1.39 to now - Rust 1.70
194+
* 1.48 to now - Rust 1.71
195+
* 1.39 to 1.47 - Rust 1.70
195196
* 1.30 to 1.38 - Rust 1.63
196197
* 1.27 to 1.29 - Rust 1.56
197198
* 1.17 to 1.26 - Rust 1.49

0 commit comments

Comments
 (0)