Skip to content

Upgrading tokio 0.3 to 1

Breaking0.3.7 → 1.54.1Breaking20Security7Platform7Deprecated2New301Changed190Fixed283Other284

BreakingUpgrade verdict

20 breaking changes and 7 platform requirement changes and 7 security fixes.

  • runtime: removed borrow from LocalOptions parameter to runtime::Builder::build_local ().
  • Removes the unused `stats` feature.
  • Removes unused `tokio_*` cfgs.
  • Removes the build script to speed up compilation.
Top 5 of 36 that need code or config changes

Requires Rust 1.85 from 1.54.0 (none stated before).

Breaking20
runtime: removed borrow from LocalOptions parameter to runtime::Builder::build_local ().
LocalOptionsruntime::Builder::build_local
Removes the unused stats feature.
stats
Removes unused tokio_* cfgs.
tokio_*
Removes the build script to speed up compilation.
Removes the Send implementation from runtime::EnterGuard, fixing a bug that should not impact most users.
runtime::EnterGuard
Renames unstable join_one to join_next in joinset.
join_onejoin_next
Removes RwLockWriteGuard::map and RwLockWriteGuard::try_map to fix a soundness hole with RwLockWriteGuard::downgrade.
RwLockWriteGuard::mapRwLockWriteGuard::try_mapRwLockWriteGuard::downgrade
Renames AsyncFd::with_io() to try_io().
AsyncFd::with_io()AsyncFd::try_io()
Renames runtime::Builder::max_threads() to max_blocking_threads().
runtime::Builder::max_threads()runtime::Builder::max_blocking_threads()
Removes tokio::prelude.
tokio::prelude
Removes AsyncFd::with_poll().
AsyncFd::with_poll()
Removes {Tcp,Unix}Stream::shutdown() in favor of AsyncWrite::shutdown().
TcpStream::shutdown()UnixStream::shutdown()AsyncWrite::shutdown()
Removes mpsc try_recv() due to unexpected behavior.
try_recv()
Makes the unstable task::Builder::spawn* methods fallible.
task::Builder::spawn*
Overhauls the runtime metrics API when building with --cfg tokio_unstable.
Makes Sleep !Unpin.
Sleep
Passes SocketAddr by value.
SocketAddr
Changes TcpStream::poll_peek to take ReadBuf.
TcpStream::poll_peekReadBuf
Requires the current_thread runtime when calling time::pause().
time::pause()current_thread
Moves all stream utilities to tokio-stream until Stream is added to std.
tokio-streamStream
Security7
Race condition in tokio::time::Interval on Tokio v1.54.0
AsyncFd::new and related constructors violate I/O safety
Broadcast channel calls clone in parallel, but does not require Sync
tokio::io::ReadHalf<T>::unsplit is Unsound
reject_remote_clients Configuration corruption
Fixes a data race between oneshot::Sender::send and awaiting a oneshot::Receiver when the oneshot has been closed.
oneshot::Sender::sendoneshot::Receiver
Task dropped in wrong thread when aborting LocalSet task
Platform7
Increases the minimum supported Rust version (MSRV) to 1.85.
Bumps the minimum supported Rust version (MSRV) to 1.70.
Bumps the MSRV of Tokio to 1.63.
Bumps the MSRV of Tokio to 1.56.
Removes the dependency on the once_cell crate to restore the MSRV of the 1.18.x LTS release.
once_cell
Updates the minimum supported Rust version to 1.49.
Updates the minimum supported Rust version to 1.46.
Deprecated2
Deprecates AsyncFd::new, AsyncFd::with_interest, AsyncFd::try_new and AsyncFd::try_with_interest.
AsyncFd::newAsyncFd::with_interestAsyncFd::try_newAsyncFd::try_with_interest
Deprecates the unused mpsc::RecvError type.
mpsc::RecvError