mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
chore: bump MSRV to 1.46 (#4254)
This commit is contained in:
parent
8943e8aeef
commit
cf3206842c
@ -1 +1 @@
|
||||
msrv = "1.45"
|
||||
msrv = "1.46"
|
||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -10,7 +10,7 @@ env:
|
||||
RUSTFLAGS: -Dwarnings
|
||||
RUST_BACKTRACE: 1
|
||||
nightly: nightly-2021-10-25
|
||||
minrust: 1.45.2
|
||||
minrust: 1.46
|
||||
|
||||
jobs:
|
||||
# Depends on all action sthat are required for a "successful" CI run.
|
||||
|
@ -164,7 +164,7 @@ several other libraries, including:
|
||||
## Supported Rust Versions
|
||||
|
||||
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.
|
||||
|
||||
## Release schedule
|
||||
|
@ -8,6 +8,7 @@ name = "tokio-macros"
|
||||
# - Create "tokio-macros-1.0.x" git tag.
|
||||
version = "1.6.0"
|
||||
edition = "2018"
|
||||
rust-version = "1.46"
|
||||
authors = ["Tokio Contributors <team@tokio.rs>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
@ -8,6 +8,7 @@ name = "tokio-stream"
|
||||
# - Create "tokio-stream-0.1.x" git tag.
|
||||
version = "0.1.8"
|
||||
edition = "2018"
|
||||
rust-version = "1.46"
|
||||
authors = ["Tokio Contributors <team@tokio.rs>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
@ -8,6 +8,7 @@ name = "tokio-test"
|
||||
# - Create "tokio-test-0.4.x" git tag.
|
||||
version = "0.4.2"
|
||||
edition = "2018"
|
||||
rust-version = "1.46"
|
||||
authors = ["Tokio Contributors <team@tokio.rs>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
@ -8,6 +8,7 @@ name = "tokio-util"
|
||||
# - Create "tokio-util-0.6.x" git tag.
|
||||
version = "0.6.9"
|
||||
edition = "2018"
|
||||
rust-version = "1.46"
|
||||
authors = ["Tokio Contributors <team@tokio.rs>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
|
@ -9,6 +9,7 @@ name = "tokio"
|
||||
# - Create "v1.0.x" git tag.
|
||||
version = "1.14.0"
|
||||
edition = "2018"
|
||||
rust-version = "1.46"
|
||||
authors = ["Tokio Contributors <team@tokio.rs>"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
@ -137,9 +138,6 @@ mio-aio = { version = "0.6.0", features = ["tokio"] }
|
||||
[target.'cfg(loom)'.dev-dependencies]
|
||||
loom = { version = "0.5", features = ["futures", "checkpoint"] }
|
||||
|
||||
[build-dependencies]
|
||||
autocfg = "1" # Needed for conditionally enabling `track-caller`
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
@ -164,7 +164,7 @@ several other libraries, including:
|
||||
## Supported Rust Versions
|
||||
|
||||
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.
|
||||
|
||||
## Release schedule
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
||||
where
|
||||
F: Future + Send + 'static,
|
||||
@ -187,7 +187,7 @@ impl Handle {
|
||||
/// 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>
|
||||
where
|
||||
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>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
@ -211,9 +211,7 @@ impl Handle {
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let fut = {
|
||||
use tracing::Instrument;
|
||||
#[cfg(tokio_track_caller)]
|
||||
let location = std::panic::Location::caller();
|
||||
#[cfg(tokio_track_caller)]
|
||||
let span = tracing::trace_span!(
|
||||
target: "tokio::task::blocking",
|
||||
"runtime.spawn",
|
||||
@ -222,14 +220,6 @@ impl Handle {
|
||||
"fn" = %std::any::type_name::<F>(),
|
||||
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)
|
||||
};
|
||||
|
||||
@ -311,7 +301,7 @@ impl Handle {
|
||||
/// [`tokio::fs`]: crate::fs
|
||||
/// [`tokio::net`]: crate::net
|
||||
/// [`tokio::time`]: crate::time
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn block_on<F: Future>(&self, future: F) -> F::Output {
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let future = crate::util::trace::task(future, "block_on", None);
|
||||
|
@ -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>
|
||||
where
|
||||
F: Future + Send + 'static,
|
||||
@ -400,7 +400,7 @@ cfg_rt! {
|
||||
/// 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>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
@ -450,7 +450,7 @@ cfg_rt! {
|
||||
/// ```
|
||||
///
|
||||
/// [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 {
|
||||
#[cfg(all(tokio_unstable, feature = "tracing"))]
|
||||
let future = crate::util::trace::task(future, "block_on", None);
|
||||
|
@ -188,7 +188,7 @@ cfg_rt! {
|
||||
/// worker.await.unwrap();
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn spawn_blocking<F, R>(f: F) -> JoinHandle<R>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
|
@ -65,7 +65,7 @@ impl<'a> Builder<'a> {
|
||||
///
|
||||
/// See [`task::spawn`](crate::task::spawn) for
|
||||
/// more details.
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn spawn<Fut>(self, future: Fut) -> JoinHandle<Fut::Output>
|
||||
where
|
||||
Fut: Future + Send + 'static,
|
||||
@ -78,7 +78,7 @@ impl<'a> Builder<'a> {
|
||||
///
|
||||
/// See [`task::spawn_local`](crate::task::spawn_local)
|
||||
/// for more details.
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn spawn_local<Fut>(self, future: Fut) -> JoinHandle<Fut::Output>
|
||||
where
|
||||
Fut: Future + 'static,
|
||||
@ -91,7 +91,7 @@ impl<'a> Builder<'a> {
|
||||
///
|
||||
/// See [`task::spawn_blocking`](crate::task::spawn_blocking)
|
||||
/// for more details.
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn spawn_blocking<Function, Output>(self, function: Function) -> JoinHandle<Output>
|
||||
where
|
||||
Function: FnOnce() -> Output + Send + 'static,
|
||||
|
@ -286,7 +286,7 @@ cfg_rt! {
|
||||
/// }).await;
|
||||
/// }
|
||||
/// ```
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn spawn_local<F>(future: F) -> JoinHandle<F::Output>
|
||||
where
|
||||
F: Future + 'static,
|
||||
@ -377,7 +377,7 @@ impl LocalSet {
|
||||
/// }
|
||||
/// ```
|
||||
/// [`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>
|
||||
where
|
||||
F: Future + 'static,
|
||||
|
@ -121,7 +121,7 @@ cfg_rt! {
|
||||
/// ```text
|
||||
/// 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>
|
||||
where
|
||||
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>
|
||||
where
|
||||
T: Future + Send + 'static,
|
||||
|
@ -45,7 +45,7 @@ cfg_trace! {
|
||||
/// [`interval`]: crate::time::interval()
|
||||
// Alias for old name in 0.x
|
||||
#[cfg_attr(docsrs, doc(alias = "delay_until"))]
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn sleep_until(deadline: Instant) -> Sleep {
|
||||
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
|
||||
#[cfg_attr(docsrs, doc(alias = "delay_for"))]
|
||||
#[cfg_attr(docsrs, doc(alias = "wait"))]
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
pub fn sleep(duration: Duration) -> Sleep {
|
||||
let location = trace::caller_location();
|
||||
|
||||
@ -232,10 +232,8 @@ impl Sleep {
|
||||
let deadline_tick = time_source.deadline_to_tick(deadline);
|
||||
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");
|
||||
|
||||
#[cfg(tokio_track_caller)]
|
||||
let resource_span = tracing::trace_span!(
|
||||
"runtime.resource",
|
||||
concrete_type = "Sleep",
|
||||
@ -245,10 +243,6 @@ impl Sleep {
|
||||
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 =
|
||||
tracing::trace_span!("runtime.resource.async_op", source = "Sleep::new_timeout");
|
||||
|
||||
|
@ -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>
|
||||
where
|
||||
T: Future,
|
||||
|
@ -3,12 +3,10 @@ cfg_trace! {
|
||||
pub(crate) use tracing::instrument::Instrumented;
|
||||
|
||||
#[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> {
|
||||
use tracing::instrument::Instrument;
|
||||
#[cfg(tokio_track_caller)]
|
||||
let location = std::panic::Location::caller();
|
||||
#[cfg(tokio_track_caller)]
|
||||
let span = tracing::trace_span!(
|
||||
target: "tokio::task",
|
||||
"runtime.spawn",
|
||||
@ -18,23 +16,16 @@ cfg_trace! {
|
||||
loc.line = location.line(),
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
cfg_time! {
|
||||
#[cfg_attr(tokio_track_caller, track_caller)]
|
||||
#[track_caller]
|
||||
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());
|
||||
#[cfg(not(all(tokio_track_caller, tokio_unstable, feature = "tracing")))]
|
||||
#[cfg(not(all(tokio_unstable, feature = "tracing")))]
|
||||
None
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user