Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tokio-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
Expand Down
2 changes: 1 addition & 1 deletion tokio-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
Expand Down
11 changes: 2 additions & 9 deletions tokio-stream/src/stream_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down
2 changes: 1 addition & 1 deletion tokio-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
Expand Down
36 changes: 11 additions & 25 deletions tokio-util/src/task/join_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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)
}

Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand Down
5 changes: 3 additions & 2 deletions tokio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions tokio/src/loom/std/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down
Loading