Skip to content

Commit

Permalink
chore: bump MSRV to 1.46 (#4254)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Nov 23, 2021
1 parent 8943e8a commit cf32068
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.45"
msrv = "1.46"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tokio-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tokio-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tokio-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion tokio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 0 additions & 22 deletions tokio/build.rs

This file was deleted.

18 changes: 4 additions & 14 deletions tokio/src/runtime/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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",
Expand All @@ -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)
};

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions tokio/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/task/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tokio/src/task/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/task/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/task/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
10 changes: 2 additions & 8 deletions tokio/src/time/driver/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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",
Expand All @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion tokio/src/time/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 4 additions & 13 deletions tokio/src/util/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
}
}
Expand Down

0 comments on commit cf32068

Please sign in to comment.