mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
tokio: bump MSRV to 1.56 (#5559)
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
msrv = "1.49"
|
||||
msrv = "1.56"
|
||||
|
||||
@@ -21,7 +21,7 @@ env:
|
||||
# - tokio-util/Cargo.toml
|
||||
# - tokio-test/Cargo.toml
|
||||
# - tokio-stream/Cargo.toml
|
||||
rust_min: 1.49.0
|
||||
rust_min: 1.56.0
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
||||
@@ -187,7 +187,20 @@ 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.49.0.
|
||||
released at least six months ago. The current MSRV is 1.56.0.
|
||||
|
||||
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.17 to 1.26 - Rust 1.49
|
||||
* 1.15 to 1.16 - Rust 1.46
|
||||
* 1.0 to 1.14 - Rust 1.45
|
||||
|
||||
Note that although we try to avoid the situation where a dependency transitively
|
||||
increases the MSRV of Tokio, we do not guarantee that this does not happen.
|
||||
However, every minor release will have some set of versions of dependencies that
|
||||
works with the MSRV of that minor release.
|
||||
|
||||
## Release schedule
|
||||
|
||||
@@ -202,9 +215,9 @@ warrants a patch release with a fix for the bug, it will be backported and
|
||||
released as a new patch release for each LTS minor version. Our current LTS
|
||||
releases are:
|
||||
|
||||
* `1.18.x` - LTS release until June 2023
|
||||
* `1.20.x` - LTS release until September 2023.
|
||||
* `1.25.x` - LTS release until March 2024
|
||||
* `1.18.x` - LTS release until June 2023. (MSRV 1.49)
|
||||
* `1.20.x` - LTS release until September 2023. (MSRV 1.49)
|
||||
* `1.25.x` - LTS release until March 2024. (MSRV 1.49)
|
||||
|
||||
Each LTS release will continue to receive backported fixes for at least a year.
|
||||
If you wish to use a fixed minor release in your project, we recommend that you
|
||||
|
||||
@@ -6,7 +6,7 @@ name = "tokio-macros"
|
||||
# - Create "tokio-macros-1.x.y" git tag.
|
||||
version = "1.8.2"
|
||||
edition = "2018"
|
||||
rust-version = "1.49"
|
||||
rust-version = "1.56"
|
||||
authors = ["Tokio Contributors <[email protected]>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
||||
@@ -6,7 +6,7 @@ name = "tokio-stream"
|
||||
# - Create "tokio-stream-0.1.x" git tag.
|
||||
version = "0.1.12"
|
||||
edition = "2018"
|
||||
rust-version = "1.49"
|
||||
rust-version = "1.56"
|
||||
authors = ["Tokio Contributors <[email protected]>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
||||
@@ -6,7 +6,7 @@ name = "tokio-test"
|
||||
# - Create "tokio-test-0.4.x" git tag.
|
||||
version = "0.4.2"
|
||||
edition = "2018"
|
||||
rust-version = "1.49"
|
||||
rust-version = "1.56"
|
||||
authors = ["Tokio Contributors <[email protected]>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
||||
@@ -6,7 +6,7 @@ name = "tokio-util"
|
||||
# - Create "tokio-util-0.7.x" git tag.
|
||||
version = "0.7.7"
|
||||
edition = "2018"
|
||||
rust-version = "1.49"
|
||||
rust-version = "1.56"
|
||||
authors = ["Tokio Contributors <[email protected]>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
||||
@@ -239,11 +239,7 @@ fn remove_child(parent: &mut Inner, mut node: MutexGuard<'_, Inner>) {
|
||||
|
||||
let len = parent.children.len();
|
||||
if 4 * len <= parent.children.capacity() {
|
||||
// equal to:
|
||||
// parent.children.shrink_to(2 * len);
|
||||
// but shrink_to was not yet stabilized in our minimal compatible version
|
||||
let old_children = std::mem::replace(&mut parent.children, Vec::with_capacity(2 * len));
|
||||
parent.children.extend(old_children);
|
||||
parent.children.shrink_to(2 * len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ name = "tokio"
|
||||
# - Update CHANGELOG.md.
|
||||
# - Create "v1.x.y" git tag.
|
||||
version = "1.26.0"
|
||||
edition = "2018"
|
||||
rust-version = "1.49"
|
||||
edition = "2021"
|
||||
rust-version = "1.56"
|
||||
authors = ["Tokio Contributors <[email protected]>"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
|
||||
+17
-4
@@ -187,7 +187,20 @@ 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.49.0.
|
||||
released at least six months ago. The current MSRV is 1.56.0.
|
||||
|
||||
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.17 to 1.26 - Rust 1.49
|
||||
* 1.15 to 1.16 - Rust 1.46
|
||||
* 1.0 to 1.14 - Rust 1.45
|
||||
|
||||
Note that although we try to avoid the situation where a dependency transitively
|
||||
increases the MSRV of Tokio, we do not guarantee that this does not happen.
|
||||
However, every minor release will have some set of versions of dependencies that
|
||||
works with the MSRV of that minor release.
|
||||
|
||||
## Release schedule
|
||||
|
||||
@@ -202,9 +215,9 @@ warrants a patch release with a fix for the bug, it will be backported and
|
||||
released as a new patch release for each LTS minor version. Our current LTS
|
||||
releases are:
|
||||
|
||||
* `1.18.x` - LTS release until June 2023
|
||||
* `1.20.x` - LTS release until September 2023.
|
||||
* `1.25.x` - LTS release until March 2024
|
||||
* `1.18.x` - LTS release until June 2023. (MSRV 1.49)
|
||||
* `1.20.x` - LTS release until September 2023. (MSRV 1.49)
|
||||
* `1.25.x` - LTS release until March 2024. (MSRV 1.49)
|
||||
|
||||
Each LTS release will continue to receive backported fixes for at least a year.
|
||||
If you wish to use a fixed minor release in your project, we recommend that you
|
||||
|
||||
@@ -10,13 +10,6 @@ const CONST_THREAD_LOCAL_PROBE: &str = r#"
|
||||
}
|
||||
"#;
|
||||
|
||||
const ADDR_OF_PROBE: &str = r#"
|
||||
{
|
||||
let my_var = 10;
|
||||
::std::ptr::addr_of!(my_var)
|
||||
}
|
||||
"#;
|
||||
|
||||
const CONST_MUTEX_NEW_PROBE: &str = r#"
|
||||
{
|
||||
static MY_MUTEX: ::std::sync::Mutex<i32> = ::std::sync::Mutex::new(1);
|
||||
@@ -53,7 +46,6 @@ const TARGET_ATOMIC_U64_PROBE: &str = r#"
|
||||
|
||||
fn main() {
|
||||
let mut enable_const_thread_local = false;
|
||||
let mut enable_addr_of = false;
|
||||
let mut enable_target_has_atomic = false;
|
||||
let mut enable_const_mutex_new = false;
|
||||
let mut enable_as_fd = false;
|
||||
@@ -81,21 +73,6 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// The `addr_of` and `addr_of_mut` macros were stabilized in 1.51.
|
||||
if ac.probe_rustc_version(1, 52) {
|
||||
enable_addr_of = true;
|
||||
} else if ac.probe_rustc_version(1, 51) {
|
||||
// This compiler claims to be 1.51, but there are some nightly
|
||||
// compilers that claim to be 1.51 without supporting the
|
||||
// feature. Explicitly probe to check if code using them
|
||||
// compiles.
|
||||
//
|
||||
// The oldest nightly that supports the feature is 2021-01-31.
|
||||
if ac.probe_expression(ADDR_OF_PROBE) {
|
||||
enable_addr_of = true;
|
||||
}
|
||||
}
|
||||
|
||||
// The `target_has_atomic` cfg was stabilized in 1.60.
|
||||
if ac.probe_rustc_version(1, 61) {
|
||||
enable_target_has_atomic = true;
|
||||
@@ -167,14 +144,6 @@ fn main() {
|
||||
autocfg::emit("tokio_no_const_thread_local")
|
||||
}
|
||||
|
||||
if !enable_addr_of {
|
||||
// To disable this feature on compilers that support it, you can
|
||||
// explicitly pass this flag with the following environment variable:
|
||||
//
|
||||
// RUSTFLAGS="--cfg tokio_no_addr_of"
|
||||
autocfg::emit("tokio_no_addr_of")
|
||||
}
|
||||
|
||||
if !enable_target_has_atomic {
|
||||
// To disable this feature on compilers that support it, you can
|
||||
// explicitly pass this flag with the following environment variable:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! This module defines a macro that lets you go from a raw pointer to a struct
|
||||
//! to a raw pointer to a field of the struct.
|
||||
|
||||
#[cfg(not(tokio_no_addr_of))]
|
||||
macro_rules! generate_addr_of_methods {
|
||||
(
|
||||
impl<$($gen:ident)*> $struct_name:ty {$(
|
||||
@@ -21,33 +20,3 @@ macro_rules! generate_addr_of_methods {
|
||||
)*}
|
||||
};
|
||||
}
|
||||
|
||||
// The `addr_of_mut!` macro is only available for MSRV at least 1.51.0. This
|
||||
// version of the macro uses a workaround for older versions of rustc.
|
||||
#[cfg(tokio_no_addr_of)]
|
||||
macro_rules! generate_addr_of_methods {
|
||||
(
|
||||
impl<$($gen:ident)*> $struct_name:ty {$(
|
||||
$(#[$attrs:meta])*
|
||||
$vis:vis unsafe fn $fn_name:ident(self: NonNull<Self>) -> NonNull<$field_type:ty> {
|
||||
&self$(.$field_name:tt)+
|
||||
}
|
||||
)*}
|
||||
) => {
|
||||
impl<$($gen)*> $struct_name {$(
|
||||
$(#[$attrs])*
|
||||
$vis unsafe fn $fn_name(me: ::core::ptr::NonNull<Self>) -> ::core::ptr::NonNull<$field_type> {
|
||||
let me = me.as_ptr();
|
||||
let me_u8 = me as *mut u8;
|
||||
|
||||
let field_offset = {
|
||||
let me_ref = &*me;
|
||||
let field_ref_u8 = (&me_ref $(.$field_name)+ ) as *const $field_type as *const u8;
|
||||
field_ref_u8.offset_from(me_u8)
|
||||
};
|
||||
|
||||
::core::ptr::NonNull::new_unchecked(me_u8.offset(field_offset).cast())
|
||||
}
|
||||
)*}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ cfg_not_wasi! {
|
||||
use crate::net::{to_socket_addrs, ToSocketAddrs};
|
||||
}
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::net::{self, SocketAddr};
|
||||
|
||||
@@ -8,7 +8,6 @@ use crate::io::{AsyncRead, AsyncWrite, Interest, PollEvented, ReadBuf, Ready};
|
||||
use crate::net::tcp::split::{split, ReadHalf, WriteHalf};
|
||||
use crate::net::tcp::split_owned::{split_owned, OwnedReadHalf, OwnedWriteHalf};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::net::{Shutdown, SocketAddr};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::io::{Interest, PollEvented, ReadBuf, Ready};
|
||||
use crate::net::{to_socket_addrs, ToSocketAddrs};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::io::{Interest, PollEvented, ReadBuf, Ready};
|
||||
use crate::net::unix::SocketAddr;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::net::Shutdown;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::io::{Interest, PollEvented};
|
||||
use crate::net::unix::{SocketAddr, UnixStream};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
#[cfg(not(tokio_no_as_fd))]
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::net::unix::split_owned::{split_owned, OwnedReadHalf, OwnedWriteHalf};
|
||||
use crate::net::unix::ucred::{self, UCred};
|
||||
use crate::net::unix::SocketAddr;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::io::{self, Read, Write};
|
||||
use std::net::Shutdown;
|
||||
|
||||
@@ -156,7 +156,6 @@
|
||||
//! ```no_run
|
||||
//! use tokio::join;
|
||||
//! use tokio::process::Command;
|
||||
//! use std::convert::TryInto;
|
||||
//! use std::process::Stdio;
|
||||
//!
|
||||
//! #[tokio::main]
|
||||
@@ -245,7 +244,6 @@ mod kill;
|
||||
use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use crate::process::kill::Kill;
|
||||
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::OsStr;
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::runtime::WorkerMetrics;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
use std::time::Instant;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use crate::time::{Clock, Duration, Instant};
|
||||
|
||||
use std::convert::TryInto;
|
||||
|
||||
/// A structure which handles conversion from Instants to u64 timestamps.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct TimeSource {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::io;
|
||||
use std::sync::Once;
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ impl ops::Sub<Duration> for Instant {
|
||||
type Output = Instant;
|
||||
|
||||
fn sub(self, rhs: Duration) -> Instant {
|
||||
Instant::from_std(self.std - rhs)
|
||||
Instant::from_std(std::time::Instant::sub(self.std, rhs))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ use crate::future::poll_fn;
|
||||
use crate::time::{sleep_until, Duration, Instant, Sleep};
|
||||
use crate::util::trace;
|
||||
|
||||
use std::future::Future;
|
||||
use std::panic::Location;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::{convert::TryInto, future::Future};
|
||||
|
||||
/// Creates new [`Interval`] that yields with interval of `period`. The first
|
||||
/// tick completes immediately. The default [`MissedTickBehavior`] is
|
||||
|
||||
@@ -560,7 +560,7 @@ impl<T> Slots<T> {
|
||||
assert!(slot >= base, "unexpected pointer");
|
||||
|
||||
let idx = (slot - base) / width;
|
||||
assert!(idx < self.slots.len() as usize);
|
||||
assert!(idx < self.slots.len());
|
||||
|
||||
idx
|
||||
}
|
||||
|
||||
@@ -206,47 +206,56 @@ async fn nested() {
|
||||
assert_eq!(res, 3);
|
||||
}
|
||||
|
||||
#[maybe_tokio_test]
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
async fn struct_size() {
|
||||
mod pointer_64_tests {
|
||||
use super::maybe_tokio_test;
|
||||
use futures::future;
|
||||
use std::mem;
|
||||
|
||||
let fut = async {
|
||||
let ready = future::ready(0i32);
|
||||
#[maybe_tokio_test]
|
||||
async fn struct_size_1() {
|
||||
let fut = async {
|
||||
let ready = future::ready(0i32);
|
||||
|
||||
tokio::select! {
|
||||
_ = ready => {},
|
||||
}
|
||||
};
|
||||
tokio::select! {
|
||||
_ = ready => {},
|
||||
}
|
||||
};
|
||||
|
||||
assert_eq!(mem::size_of_val(&fut), 40);
|
||||
assert_eq!(mem::size_of_val(&fut), 32);
|
||||
}
|
||||
|
||||
let fut = async {
|
||||
let ready1 = future::ready(0i32);
|
||||
let ready2 = future::ready(0i32);
|
||||
#[maybe_tokio_test]
|
||||
async fn struct_size_2() {
|
||||
let fut = async {
|
||||
let ready1 = future::ready(0i32);
|
||||
let ready2 = future::ready(0i32);
|
||||
|
||||
tokio::select! {
|
||||
_ = ready1 => {},
|
||||
_ = ready2 => {},
|
||||
}
|
||||
};
|
||||
tokio::select! {
|
||||
_ = ready1 => {},
|
||||
_ = ready2 => {},
|
||||
}
|
||||
};
|
||||
|
||||
assert_eq!(mem::size_of_val(&fut), 48);
|
||||
assert_eq!(mem::size_of_val(&fut), 40);
|
||||
}
|
||||
|
||||
let fut = async {
|
||||
let ready1 = future::ready(0i32);
|
||||
let ready2 = future::ready(0i32);
|
||||
let ready3 = future::ready(0i32);
|
||||
#[maybe_tokio_test]
|
||||
async fn struct_size_3() {
|
||||
let fut = async {
|
||||
let ready1 = future::ready(0i32);
|
||||
let ready2 = future::ready(0i32);
|
||||
let ready3 = future::ready(0i32);
|
||||
|
||||
tokio::select! {
|
||||
_ = ready1 => {},
|
||||
_ = ready2 => {},
|
||||
_ = ready3 => {},
|
||||
}
|
||||
};
|
||||
tokio::select! {
|
||||
_ = ready1 => {},
|
||||
_ = ready2 => {},
|
||||
_ = ready3 => {},
|
||||
}
|
||||
};
|
||||
|
||||
assert_eq!(mem::size_of_val(&fut), 56);
|
||||
assert_eq!(mem::size_of_val(&fut), 48);
|
||||
}
|
||||
}
|
||||
|
||||
#[maybe_tokio_test]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::net;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -12,7 +12,7 @@ use tokio_test::assert_ok;
|
||||
#[tokio::test]
|
||||
async fn kill_on_drop() {
|
||||
let mut cmd = Command::new("bash");
|
||||
cmd.args(&[
|
||||
cmd.args([
|
||||
"-c",
|
||||
"
|
||||
# Fork another child that won't get killed
|
||||
|
||||
@@ -7,7 +7,7 @@ use tokio::net::TcpStream;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use std::thread;
|
||||
use std::{convert::TryInto, io::Write, net};
|
||||
use std::{io::Write, net};
|
||||
|
||||
#[tokio::test]
|
||||
async fn peek() {
|
||||
|
||||
Reference in New Issue
Block a user