Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump tokio MSRV to 1.63 #5887

Merged
merged 12 commits into from
Jul 27, 2023
Merged
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
# - tokio-util/Cargo.toml
# - tokio-test/Cargo.toml
# - tokio-stream/Cargo.toml
rust_min: 1.56.0
rust_min: 1.63.0

defaults:
run:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,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
NobodyXu marked this conversation as resolved.
Show resolved Hide resolved
released at least six months ago. The current MSRV is 1.56.0.
released at least six months ago. The current MSRV is 1.63.

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.27 to now - Rust 1.56
* 1.30 to now - Rust 1.63
* 1.27 to 1.29 - Rust 1.56
* 1.17 to 1.26 - Rust 1.49
* 1.15 to 1.16 - Rust 1.46
* 1.0 to 1.14 - Rust 1.45
Expand Down
17 changes: 7 additions & 10 deletions tokio/Cargo.toml
NobodyXu marked this conversation as resolved.
Show resolved Hide resolved
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.29.1"
edition = "2021"
rust-version = "1.56"
rust-version = "1.63"
authors = ["Tokio Contributors <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand Down Expand Up @@ -93,9 +93,6 @@ time = []
# a few releases.
stats = []

[build-dependencies]
autocfg = "1.1"

[dependencies]
tokio-macros = { version = "~2.1.0", path = "../tokio-macros", optional = true }

Expand All @@ -107,8 +104,8 @@ mio = { version = "0.8.6", optional = true, default-features = false }
num_cpus = { version = "1.8.0", optional = true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this not be replaced by std::thread::available_parallelism?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is outside the scope of this PR.

This PR is for bumping MSRV for tokio only, you can open another PR/issue/discussion for this.

Copy link
Member

@taiki-e taiki-e Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

available_parallelism was stabilized with an incomplete implementation, and it is expected to cause regressions (e.g., OOM) in Rust 1.63 and smaller that doesn't have cgroupv1 support (rust-lang/rust#97925).

So I think we need to stick to num_cpus until MSRV becomes 1.64+.

parking_lot = { version = "0.12.0", optional = true }

[target.'cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))'.dependencies]
socket2 = { version = "0.4.9", optional = true, features = [ "all" ] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
socket2 = { version = "0.5.3", optional = true, features = [ "all" ] }

# Currently unstable. The API exposed by these features may be broken at any time.
# Requires `--cfg tokio_unstable` to enable.
Expand Down Expand Up @@ -146,14 +143,14 @@ futures = { version = "0.3.0", features = ["async-await"] }
mockall = "0.11.1"
async-stream = "0.3"

[target.'cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))'.dev-dependencies]
socket2 = "0.4.9"
[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
socket2 = "0.5.3"
tempfile = "3.1.0"

[target.'cfg(not(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown")))'.dev-dependencies]
[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dev-dependencies]
rand = "0.8.0"

[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_os = "wasi")))'.dev-dependencies]
[target.'cfg(all(target_family = "wasm", not(target_os = "wasi")))'.dev-dependencies]
wasm-bindgen-test = "0.3.0"

[target.'cfg(target_os = "freebsd")'.dev-dependencies]
Expand Down
5 changes: 3 additions & 2 deletions tokio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,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.56.0.
released at least six months ago. The current MSRV is 1.63.

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.27 to now - Rust 1.56
* 1.30 to now - Rust 1.63
* 1.27 to 1.29 - Rust 1.56
* 1.17 to 1.26 - Rust 1.49
* 1.15 to 1.16 - Rust 1.46
* 1.0 to 1.14 - Rust 1.45
Expand Down
192 changes: 0 additions & 192 deletions tokio/build.rs

This file was deleted.

4 changes: 2 additions & 2 deletions tokio/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ cfg_io_driver_impl! {
pub use ready::Ready;
}

#[cfg_attr(tokio_wasi, allow(unused_imports))]
#[cfg_attr(target_os = "wasi", allow(unused_imports))]
mod poll_evented;

#[cfg(not(loom))]
#[cfg_attr(tokio_wasi, allow(unused_imports))]
#[cfg_attr(target_os = "wasi", allow(unused_imports))]
pub(crate) use poll_evented::PollEvented;
}

Expand Down
19 changes: 1 addition & 18 deletions tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,26 +456,9 @@ compile_error! {
"Tokio requires the platform pointer width to be 32, 64, or 128 bits"
}

// Ensure that our build script has correctly set cfg flags for wasm.
//
// Each condition is written all(a, not(b)). This should be read as
// "if a, then we must also have b".
#[cfg(any(
all(target_arch = "wasm32", not(tokio_wasm)),
all(target_arch = "wasm64", not(tokio_wasm)),
all(target_family = "wasm", not(tokio_wasm)),
all(target_os = "wasi", not(tokio_wasm)),
all(target_os = "wasi", not(tokio_wasi)),
all(target_os = "wasi", tokio_wasm_not_wasi),
all(tokio_wasm, not(any(target_arch = "wasm32", target_arch = "wasm64"))),
all(tokio_wasm_not_wasi, not(tokio_wasm)),
all(tokio_wasi, not(tokio_wasm))
))]
compile_error!("Tokio's build script has incorrectly detected wasm.");

#[cfg(all(
not(tokio_unstable),
tokio_wasm,
target_family = "wasm",
any(
feature = "fs",
feature = "io-std",
Expand Down
12 changes: 6 additions & 6 deletions tokio/src/macros/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ macro_rules! cfg_fs {
($($item:item)*) => {
$(
#[cfg(feature = "fs")]
#[cfg(not(tokio_wasi))]
#[cfg(not(target_os = "wasi"))]
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
$item
)*
Expand Down Expand Up @@ -276,7 +276,7 @@ macro_rules! cfg_process {
#[cfg(feature = "process")]
#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
#[cfg(not(loom))]
#[cfg(not(tokio_wasi))]
#[cfg(not(target_os = "wasi"))]
$item
)*
}
Expand Down Expand Up @@ -305,7 +305,7 @@ macro_rules! cfg_signal {
#[cfg(feature = "signal")]
#[cfg_attr(docsrs, doc(cfg(feature = "signal")))]
#[cfg(not(loom))]
#[cfg(not(tokio_wasi))]
#[cfg(not(target_os = "wasi"))]
$item
)*
}
Expand Down Expand Up @@ -372,7 +372,7 @@ macro_rules! cfg_not_rt {
macro_rules! cfg_rt_multi_thread {
($($item:item)*) => {
$(
#[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
#[cfg(all(feature = "rt-multi-thread", not(target_os = "wasi")))]
#[cfg_attr(docsrs, doc(cfg(feature = "rt-multi-thread")))]
$item
)*
Expand Down Expand Up @@ -585,7 +585,7 @@ macro_rules! cfg_not_has_const_mutex_new {
macro_rules! cfg_not_wasi {
($($item:item)*) => {
$(
#[cfg(not(tokio_wasi))]
#[cfg(not(target_os = "wasi"))]
$item
)*
}
Expand All @@ -594,7 +594,7 @@ macro_rules! cfg_not_wasi {
macro_rules! cfg_is_wasm_not_wasi {
($($item:item)*) => {
$(
#[cfg(tokio_wasm_not_wasi)]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
$item
)*
}
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/net/tcp/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl TcpListener {
.map(|raw_socket| unsafe { std::net::TcpListener::from_raw_socket(raw_socket) })
}

#[cfg(tokio_wasi)]
#[cfg(target_os = "wasi")]
{
use std::os::wasi::io::{FromRawFd, IntoRawFd};
self.io
Expand Down Expand Up @@ -416,7 +416,7 @@ mod sys {
}

cfg_unstable! {
#[cfg(tokio_wasi)]
#[cfg(target_os = "wasi")]
mod sys {
use super::TcpListener;
use std::os::wasi::prelude::*;
Expand Down
Loading
Loading