chore: bump MSRV to 1.46 (#4254)

This commit is contained in:
Taiki Endo
2021-11-23 12:09:24 +09:00
committed by GitHub
parent 8943e8aeef
commit cf3206842c
19 changed files with 31 additions and 76 deletions
+1 -1
View File
@@ -1 +1 @@
msrv = "1.45" msrv = "1.46"
+1 -1
View File
@@ -10,7 +10,7 @@ env:
RUSTFLAGS: -Dwarnings RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
nightly: nightly-2021-10-25 nightly: nightly-2021-10-25
minrust: 1.45.2 minrust: 1.46
jobs: jobs:
# Depends on all action sthat are required for a "successful" CI run. # Depends on all action sthat are required for a "successful" CI run.
+1 -1
View File
@@ -164,7 +164,7 @@ several other libraries, including:
## Supported Rust Versions ## Supported Rust Versions
Tokio is built against the latest stable release. The minimum supported version Tokio is built against the latest stable release. The minimum supported version
is 1.45. The current Tokio version is not guaranteed to build on Rust versions is 1.46. The current Tokio version is not guaranteed to build on Rust versions
earlier than the minimum supported version. earlier than the minimum supported version.
## Release schedule ## Release schedule
+1
View File
@@ -8,6 +8,7 @@ name = "tokio-macros"
# - Create "tokio-macros-1.0.x" git tag. # - Create "tokio-macros-1.0.x" git tag.
version = "1.6.0" version = "1.6.0"
edition = "2018" edition = "2018"
rust-version = "1.46"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
license = "MIT" license = "MIT"
repository = "https://github.com/tokio-rs/tokio" repository = "https://github.com/tokio-rs/tokio"
+1
View File
@@ -8,6 +8,7 @@ name = "tokio-stream"
# - Create "tokio-stream-0.1.x" git tag. # - Create "tokio-stream-0.1.x" git tag.
version = "0.1.8" version = "0.1.8"
edition = "2018" edition = "2018"
rust-version = "1.46"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
license = "MIT" license = "MIT"
repository = "https://github.com/tokio-rs/tokio" repository = "https://github.com/tokio-rs/tokio"
+1
View File
@@ -8,6 +8,7 @@ name = "tokio-test"
# - Create "tokio-test-0.4.x" git tag. # - Create "tokio-test-0.4.x" git tag.
version = "0.4.2" version = "0.4.2"
edition = "2018" edition = "2018"
rust-version = "1.46"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
license = "MIT" license = "MIT"
repository = "https://github.com/tokio-rs/tokio" repository = "https://github.com/tokio-rs/tokio"
+1
View File
@@ -8,6 +8,7 @@ name = "tokio-util"
# - Create "tokio-util-0.6.x" git tag. # - Create "tokio-util-0.6.x" git tag.
version = "0.6.9" version = "0.6.9"
edition = "2018" edition = "2018"
rust-version = "1.46"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
license = "MIT" license = "MIT"
repository = "https://github.com/tokio-rs/tokio" repository = "https://github.com/tokio-rs/tokio"
+1 -3
View File
@@ -9,6 +9,7 @@ name = "tokio"
# - Create "v1.0.x" git tag. # - Create "v1.0.x" git tag.
version = "1.14.0" version = "1.14.0"
edition = "2018" edition = "2018"
rust-version = "1.46"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
license = "MIT" license = "MIT"
readme = "README.md" readme = "README.md"
@@ -137,9 +138,6 @@ mio-aio = { version = "0.6.0", features = ["tokio"] }
[target.'cfg(loom)'.dev-dependencies] [target.'cfg(loom)'.dev-dependencies]
loom = { version = "0.5", features = ["futures", "checkpoint"] } loom = { version = "0.5", features = ["futures", "checkpoint"] }
[build-dependencies]
autocfg = "1" # Needed for conditionally enabling `track-caller`
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
+1 -1
View File
@@ -164,7 +164,7 @@ several other libraries, including:
## Supported Rust Versions ## Supported Rust Versions
Tokio is built against the latest stable release. The minimum supported version Tokio is built against the latest stable release. The minimum supported version
is 1.45. The current Tokio version is not guaranteed to build on Rust versions is 1.46. The current Tokio version is not guaranteed to build on Rust versions
earlier than the minimum supported version. earlier than the minimum supported version.
## Release schedule ## Release schedule
-22
View File
@@ -1,22 +0,0 @@
use autocfg::AutoCfg;
fn main() {
match AutoCfg::new() {
Ok(ac) => {
// The #[track_caller] attribute was stabilized in rustc 1.46.0.
if ac.probe_rustc_version(1, 46) {
autocfg::emit("tokio_track_caller")
}
}
Err(e) => {
// If we couldn't detect the compiler version and features, just
// print a warning. This isn't a fatal error: we can still build
// Tokio, we just can't enable cfgs automatically.
println!(
"cargo:warning=tokio: failed to detect compiler features: {}",
e
);
}
}
}
+4 -14
View File
@@ -157,7 +157,7 @@ impl Handle {
/// }); /// });
/// # } /// # }
/// ``` /// ```
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
where where
F: Future + Send + 'static, F: Future + Send + 'static,
@@ -187,7 +187,7 @@ impl Handle {
/// println!("now running on a worker thread"); /// println!("now running on a worker thread");
/// }); /// });
/// # } /// # }
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
where where
F: FnOnce() -> R + Send + 'static, F: FnOnce() -> R + Send + 'static,
@@ -200,7 +200,7 @@ impl Handle {
} }
} }
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub(crate) fn spawn_blocking_inner<F, R>(&self, func: F, name: Option<&str>) -> JoinHandle<R> pub(crate) fn spawn_blocking_inner<F, R>(&self, func: F, name: Option<&str>) -> JoinHandle<R>
where where
F: FnOnce() -> R + Send + 'static, F: FnOnce() -> R + Send + 'static,
@@ -211,9 +211,7 @@ impl Handle {
#[cfg(all(tokio_unstable, feature = "tracing"))] #[cfg(all(tokio_unstable, feature = "tracing"))]
let fut = { let fut = {
use tracing::Instrument; use tracing::Instrument;
#[cfg(tokio_track_caller)]
let location = std::panic::Location::caller(); let location = std::panic::Location::caller();
#[cfg(tokio_track_caller)]
let span = tracing::trace_span!( let span = tracing::trace_span!(
target: "tokio::task::blocking", target: "tokio::task::blocking",
"runtime.spawn", "runtime.spawn",
@@ -222,14 +220,6 @@ impl Handle {
"fn" = %std::any::type_name::<F>(), "fn" = %std::any::type_name::<F>(),
spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()), spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()),
); );
#[cfg(not(tokio_track_caller))]
let span = tracing::trace_span!(
target: "tokio::task::blocking",
"runtime.spawn",
kind = %"blocking",
task.name = %name.unwrap_or_default(),
"fn" = %std::any::type_name::<F>(),
);
fut.instrument(span) fut.instrument(span)
}; };
@@ -311,7 +301,7 @@ impl Handle {
/// [`tokio::fs`]: crate::fs /// [`tokio::fs`]: crate::fs
/// [`tokio::net`]: crate::net /// [`tokio::net`]: crate::net
/// [`tokio::time`]: crate::time /// [`tokio::time`]: crate::time
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn block_on<F: Future>(&self, future: F) -> F::Output { pub fn block_on<F: Future>(&self, future: F) -> F::Output {
#[cfg(all(tokio_unstable, feature = "tracing"))] #[cfg(all(tokio_unstable, feature = "tracing"))]
let future = crate::util::trace::task(future, "block_on", None); let future = crate::util::trace::task(future, "block_on", None);
+3 -3
View File
@@ -375,7 +375,7 @@ cfg_rt! {
/// }); /// });
/// # } /// # }
/// ``` /// ```
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
where where
F: Future + Send + 'static, F: Future + Send + 'static,
@@ -400,7 +400,7 @@ cfg_rt! {
/// println!("now running on a worker thread"); /// println!("now running on a worker thread");
/// }); /// });
/// # } /// # }
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
where where
F: FnOnce() -> R + Send + 'static, F: FnOnce() -> R + Send + 'static,
@@ -450,7 +450,7 @@ cfg_rt! {
/// ``` /// ```
/// ///
/// [handle]: fn@Handle::block_on /// [handle]: fn@Handle::block_on
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn block_on<F: Future>(&self, future: F) -> F::Output { pub fn block_on<F: Future>(&self, future: F) -> F::Output {
#[cfg(all(tokio_unstable, feature = "tracing"))] #[cfg(all(tokio_unstable, feature = "tracing"))]
let future = crate::util::trace::task(future, "block_on", None); let future = crate::util::trace::task(future, "block_on", None);
+1 -1
View File
@@ -188,7 +188,7 @@ cfg_rt! {
/// worker.await.unwrap(); /// worker.await.unwrap();
/// # } /// # }
/// ``` /// ```
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_blocking<F, R>(f: F) -> JoinHandle<R> pub fn spawn_blocking<F, R>(f: F) -> JoinHandle<R>
where where
F: FnOnce() -> R + Send + 'static, F: FnOnce() -> R + Send + 'static,
+3 -3
View File
@@ -65,7 +65,7 @@ impl<'a> Builder<'a> {
/// ///
/// See [`task::spawn`](crate::task::spawn) for /// See [`task::spawn`](crate::task::spawn) for
/// more details. /// more details.
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn<Fut>(self, future: Fut) -> JoinHandle<Fut::Output> pub fn spawn<Fut>(self, future: Fut) -> JoinHandle<Fut::Output>
where where
Fut: Future + Send + 'static, Fut: Future + Send + 'static,
@@ -78,7 +78,7 @@ impl<'a> Builder<'a> {
/// ///
/// See [`task::spawn_local`](crate::task::spawn_local) /// See [`task::spawn_local`](crate::task::spawn_local)
/// for more details. /// for more details.
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_local<Fut>(self, future: Fut) -> JoinHandle<Fut::Output> pub fn spawn_local<Fut>(self, future: Fut) -> JoinHandle<Fut::Output>
where where
Fut: Future + 'static, Fut: Future + 'static,
@@ -91,7 +91,7 @@ impl<'a> Builder<'a> {
/// ///
/// See [`task::spawn_blocking`](crate::task::spawn_blocking) /// See [`task::spawn_blocking`](crate::task::spawn_blocking)
/// for more details. /// for more details.
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_blocking<Function, Output>(self, function: Function) -> JoinHandle<Output> pub fn spawn_blocking<Function, Output>(self, function: Function) -> JoinHandle<Output>
where where
Function: FnOnce() -> Output + Send + 'static, Function: FnOnce() -> Output + Send + 'static,
+2 -2
View File
@@ -286,7 +286,7 @@ cfg_rt! {
/// }).await; /// }).await;
/// } /// }
/// ``` /// ```
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_local<F>(future: F) -> JoinHandle<F::Output> pub fn spawn_local<F>(future: F) -> JoinHandle<F::Output>
where where
F: Future + 'static, F: Future + 'static,
@@ -377,7 +377,7 @@ impl LocalSet {
/// } /// }
/// ``` /// ```
/// [`spawn_local`]: fn@spawn_local /// [`spawn_local`]: fn@spawn_local
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn_local<F>(&self, future: F) -> JoinHandle<F::Output> pub fn spawn_local<F>(&self, future: F) -> JoinHandle<F::Output>
where where
F: Future + 'static, F: Future + 'static,
+2 -2
View File
@@ -121,7 +121,7 @@ cfg_rt! {
/// ```text /// ```text
/// error[E0391]: cycle detected when processing `main` /// error[E0391]: cycle detected when processing `main`
/// ``` /// ```
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn spawn<T>(future: T) -> JoinHandle<T::Output> pub fn spawn<T>(future: T) -> JoinHandle<T::Output>
where where
T: Future + Send + 'static, T: Future + Send + 'static,
@@ -136,7 +136,7 @@ cfg_rt! {
} }
} }
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub(super) fn spawn_inner<T>(future: T, name: Option<&str>) -> JoinHandle<T::Output> pub(super) fn spawn_inner<T>(future: T, name: Option<&str>) -> JoinHandle<T::Output>
where where
T: Future + Send + 'static, T: Future + Send + 'static,
+2 -8
View File
@@ -45,7 +45,7 @@ cfg_trace! {
/// [`interval`]: crate::time::interval() /// [`interval`]: crate::time::interval()
// Alias for old name in 0.x // Alias for old name in 0.x
#[cfg_attr(docsrs, doc(alias = "delay_until"))] #[cfg_attr(docsrs, doc(alias = "delay_until"))]
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn sleep_until(deadline: Instant) -> Sleep { pub fn sleep_until(deadline: Instant) -> Sleep {
return Sleep::new_timeout(deadline, trace::caller_location()); return Sleep::new_timeout(deadline, trace::caller_location());
} }
@@ -89,7 +89,7 @@ pub fn sleep_until(deadline: Instant) -> Sleep {
// Alias for old name in 0.x // Alias for old name in 0.x
#[cfg_attr(docsrs, doc(alias = "delay_for"))] #[cfg_attr(docsrs, doc(alias = "delay_for"))]
#[cfg_attr(docsrs, doc(alias = "wait"))] #[cfg_attr(docsrs, doc(alias = "wait"))]
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn sleep(duration: Duration) -> Sleep { pub fn sleep(duration: Duration) -> Sleep {
let location = trace::caller_location(); let location = trace::caller_location();
@@ -232,10 +232,8 @@ impl Sleep {
let deadline_tick = time_source.deadline_to_tick(deadline); let deadline_tick = time_source.deadline_to_tick(deadline);
let duration = deadline_tick.checked_sub(time_source.now()).unwrap_or(0); let duration = deadline_tick.checked_sub(time_source.now()).unwrap_or(0);
#[cfg(tokio_track_caller)]
let location = location.expect("should have location if tracking caller"); let location = location.expect("should have location if tracking caller");
#[cfg(tokio_track_caller)]
let resource_span = tracing::trace_span!( let resource_span = tracing::trace_span!(
"runtime.resource", "runtime.resource",
concrete_type = "Sleep", concrete_type = "Sleep",
@@ -245,10 +243,6 @@ impl Sleep {
loc.col = location.column(), loc.col = location.column(),
); );
#[cfg(not(tokio_track_caller))]
let resource_span =
tracing::trace_span!("runtime.resource", concrete_type = "Sleep", kind = "timer");
let async_op_span = let async_op_span =
tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout"); tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout");
+1 -1
View File
@@ -48,7 +48,7 @@ use std::task::{self, Poll};
/// } /// }
/// # } /// # }
/// ``` /// ```
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub fn timeout<T>(duration: Duration, future: T) -> Timeout<T> pub fn timeout<T>(duration: Duration, future: T) -> Timeout<T>
where where
T: Future, T: Future,
+4 -13
View File
@@ -3,12 +3,10 @@ cfg_trace! {
pub(crate) use tracing::instrument::Instrumented; pub(crate) use tracing::instrument::Instrumented;
#[inline] #[inline]
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> { pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> {
use tracing::instrument::Instrument; use tracing::instrument::Instrument;
#[cfg(tokio_track_caller)]
let location = std::panic::Location::caller(); let location = std::panic::Location::caller();
#[cfg(tokio_track_caller)]
let span = tracing::trace_span!( let span = tracing::trace_span!(
target: "tokio::task", target: "tokio::task",
"runtime.spawn", "runtime.spawn",
@@ -18,23 +16,16 @@ cfg_trace! {
loc.line = location.line(), loc.line = location.line(),
loc.col = location.column(), loc.col = location.column(),
); );
#[cfg(not(tokio_track_caller))]
let span = tracing::trace_span!(
target: "tokio::task",
"runtime.spawn",
%kind,
task.name = %name.unwrap_or_default(),
);
task.instrument(span) task.instrument(span)
} }
} }
} }
cfg_time! { cfg_time! {
#[cfg_attr(tokio_track_caller, track_caller)] #[track_caller]
pub(crate) fn caller_location() -> Option<&'static std::panic::Location<'static>> { pub(crate) fn caller_location() -> Option<&'static std::panic::Location<'static>> {
#[cfg(all(tokio_track_caller, tokio_unstable, feature = "tracing"))] #[cfg(all(tokio_unstable, feature = "tracing"))]
return Some(std::panic::Location::caller()); return Some(std::panic::Location::caller());
#[cfg(not(all(tokio_track_caller, tokio_unstable, feature = "tracing")))] #[cfg(not(all(tokio_unstable, feature = "tracing")))]
None None
} }
} }