PackageTrack
Sign in Get early access

tokio-macros

Tokio's proc macros.

2.7.2 733M downloads/mo #107 most downloaded on crates.io tokio-rs/tokio

What this package is like to depend on

Last release 25 days ago

29 Jul 2026

Ships fairly regularly

a new release about every 4 months

Nearly every release is documented

notes for 31 of 32 stable releases

3 versions withdrawn

withdrawn after publishing

7 years old

41 releases · first in 2019

5 releases in the last 12 months

see the full history below

Release timeline

41 releases · Apr 2019 to Jul 2026
2020 2021 2022 2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 41
  1. 2.7.2 29 Jul 2026
    Release notes
    • macros: upgrade syn to v3 (#8304)
    Open source →
  2. 2.7.1 17 Jul 2026
    Release notes

    chore: prepare tokio-macros v2.7.1 (#8295)

    Open source →
    Release notes
    • macros: clarify tokio::main expansion (#8193)
    Open source →
  3. 2.7.0 03 Apr 2026
    Release notes
    • macros: stabilize LocalRuntime (#7557)
    • macros: add runtime name (#7924)
    Open source →
  4. 2.6.1 02 Mar 2026
    Release notes
    • macros: improve error message for return type mismatch in #[tokio::main] (#7856)
    • macros: use call_site hygiene to avoid unused qualification (#7866)
    Open source →
  5. 2.6.0 14 Oct 2025
    Release notes

    The MSRV is raised to 1.71.

    • msrv: increase MSRV to 1.71 (#7658)
    • macros: add local runtime flavor (#7375, #7597)
    • macros: suppress clippy::unwrap_in_result in #[tokio::main] (#7651)
    Open source →
  6. 2.5.0 08 Jan 2025
    Release notes
    • macros: suppress clippy::needless_return in #[tokio::main] (#6874)
    Open source →
  7. 2.4.0 23 Jul 2024
    Release notes
    • msrv: increase MSRV to 1.70 (#6645)
    • macros: allow unhandled_panic behavior for #[tokio::main] and #[tokio::test] (#6593)
    Open source →
  8. 2.3.0 30 May 2024
    Release notes
    • macros: make #[tokio::test] append #[test] at the end of the attribute list (#6497)
    Open source →
  9. 2.2.0 09 Nov 2023
    Release notes

    Changed

    • use ::core qualified imports instead of ::std inside tokio::test macro (#5973)
    Open source →
  10. 2.1.0 25 Apr 2023
    Release notes
    • macros: fix typo in #[tokio::test] docs (#5636)
    • macros: make entrypoints more efficient (#5621)
    Open source →
  11. 2.0.0 27 Mar 2023
    Release notes

    This major release updates the dependency on the syn crate to 2.0.0, and increases the MSRV to 1.56.

    As part of this release, we are adopting a policy of depending on a specific minor release of tokio-macros. This prevents Tokio from being able to pull in many different versions of tokio-macros.

    • macros: update syn (#5572)
    • macros: accept path as crate rename (#5557)
    Open source →
  12. 1.8.2 30 Nov 2022
    Release notes
    • fix a regression introduced in 1.8.1 (#5244)
    Open source →
    Release notes

    Fixes a missed edge case from 1.8.1.

    Fixed

    • runtime: drop canceled future on next poll (#3965)
    Open source →
  13. 1.8.1 29 Nov 2022 withdrawn
    Release notes

    (yanked)

    • macros: Pin Futures in #[tokio::test] to stack (#5205)
    • macros: Reduce usage of last statement spans in proc-macros (#5092)
    • macros: Improve the documentation for #[tokio::test] (#4761)
    Open source →
    Release notes

    Forward ports 1.5.1 fixes.

    Fixed

    • runtime: remotely abort tasks on JoinHandle::abort (#3934)
    Open source →
  14. 1.8.0 04 Jun 2022
    Release notes
    • macros: always emit return statement (#4636)
    • macros: support setting a custom crate name for #[tokio::main] and #[tokio::test] (#4613)
    Open source →
    Release notes

    Added

    • io: add get_{ref,mut} methods to AsyncFdReadyGuard and AsyncFdReadyMutGuard (#3807)
    • io: efficient implementation of vectored writes for BufWriter (#3163)
    • net: add ready/try methods to NamedPipe{Client,Server} (#3866, #3899)
    • sync: add watch::Receiver::borrow_and_update (#3813)
    • sync: implement From<T> for OnceCell<T> (#3877)
    • time: allow users to specify Interval behavior when delayed (#3721)

    Added (unstable)

    • rt: add tokio::task::Builder (#3881)

    Fixed

    • net: handle HUP event with UnixStream (#3898)

    Documented

    • doc: document cancellation safety (#3900)
    • time: add wait alias to sleep (#3897)
    • time: document auto-advancing behavior of runtime (#3763)
    Open source →
  15. 1.7.0 15 Dec 2021
    Release notes
    • macros: address remaining clippy::semicolon_if_nothing_returned warning (#4252)
    Open source →
    Release notes

    Added

    • net: add named pipes on windows (#3760)
    • net: add TcpSocket from std::net::TcpStream conversion (#3838)
    • sync: add receiver_count to watch::Sender (#3729)
    • sync: export sync::notify::Notified future publicly (#3840)
    • tracing: instrument task wakers (#3836)

    Fixed

    • macros: suppress clippy::default_numeric_fallback lint in generated code (#3831)
    • runtime: immediately drop new tasks when runtime is shut down (#3752)
    • sync: deprecate unused mpsc::RecvError type (#3833)

    Documented

    • io: clarify EOF condition for AsyncReadExt::read_buf (#3850)
    • io: clarify limits on return values of AsyncWrite::poll_write (#3820)
    • sync: add examples to Semaphore (#3808)
    Open source →
  16. 1.6.0 16 Nov 2021
    Release notes
    • macros: fix mut patterns in select! macro (#4211)
    Open source →
    Release notes

    Added

    • fs: try doing a non-blocking read before punting to the threadpool (#3518)
    • io: add write_all_buf to AsyncWriteExt (#3737)
    • io: implement AsyncSeek for BufReader, BufWriter, and BufStream (#3491)
    • net: support non-blocking vectored I/O (#3761)
    • sync: add mpsc::Sender::{reserve_owned, try_reserve_owned} (#3704)
    • sync: add a MutexGuard::map method that returns a MappedMutexGuard (#2472)
    • time: add getter for Interval's period (#3705)

    Fixed

    • io: wake pending writers on DuplexStream close (#3756)
    • process: avoid redundant effort to reap orphan processes (#3743)
    • signal: use std::os::raw::c_int instead of libc::c_int on public API (#3774)
    • sync: preserve permit state in notify_waiters (#3660)
    • task: update JoinHandle panic message (#3727)
    • time: prevent time::advance from going too far (#3712)

    Documented

    • net: hide net::unix::datagram module from docs (#3775)
    • process: updated example (#3748)
    • sync: Barrier doc should use task, not thread (#3780)
    • task: update documentation on block_in_place (#3753)
    Open source →
  17. 1.5.1 29 Oct 2021
    Release notes
    • macros: fix type resolution error in #[tokio::main] (#4176)
    Open source →
    Release notes

    Fixed

    • runtime: remotely abort tasks on JoinHandle::abort (#3934)
    Open source →
  18. 1.5.0 13 Oct 2021
    Release notes
    • macros: make tokio-macros attributes more IDE friendly (#4162)
    Open source →
    Release notes

    Added

    • io: add AsyncSeekExt::stream_position (#3650)
    • io: add AsyncWriteExt::write_vectored (#3678)
    • io: add a copy_bidirectional utility (#3572)
    • net: implement IntoRawFd for TcpSocket (#3684)
    • sync: add OnceCell (#3591)
    • sync: add OwnedRwLockReadGuard and OwnedRwLockWriteGuard (#3340)
    • sync: add Semaphore::is_closed (#3673)
    • sync: add mpsc::Sender::capacity (#3690)
    • sync: allow configuring RwLock max reads (#3644)
    • task: add sync_scope for LocalKey (#3612)

    Fixed

    • chore: try to avoid noalias attributes on intrusive linked list (#3654)
    • rt: fix panic in JoinHandle::abort() when called from other threads (#3672)
    • sync: don't panic in oneshot::try_recv (#3674)
    • sync: fix notifications getting dropped on receiver drop (#3652)
    • sync: fix Semaphore permit overflow calculation (#3644)

    Documented

    • io: clarify requirements of AsyncFd (#3635)
    • runtime: fix unclear docs for {Handle,Runtime}::block_on (#3628)
    • sync: document that Semaphore is fair (#3693)
    • sync: improve doc on blocking mutex (#3645)
    Open source →
  19. 1.4.1 30 Sep 2021
    Release notes

    Reverted: run current_thread inside LocalSet ([#4027])

    Open source →
  20. 1.4.0 29 Sep 2021 withdrawn
    Release notes

    (yanked)

    Changed

    • macros: run current_thread inside LocalSet (#4027)
    • macros: explicitly relaxed clippy lint for .expect() in runtime entry macro (#4030)

    Fixed

    • macros: fix invalid error messages in functions wrapped with #[main] or #[test] (#4067)
    Open source →
    Release notes

    Added

    • macros: introduce biased argument for select! (#3603)
    • runtime: add Handle::block_on (#3569)

    Fixed

    • runtime: avoid unnecessary polling of block_on future (#3582)
    • runtime: fix memory leak/growth when creating many runtimes (#3564)
    • runtime: mark EnterGuard with must_use (#3609)

    Documented

    • chore: mention fix for building docs in contributing guide (#3618)
    • doc: add link to PollSender (#3613)
    • doc: alias sleep to delay (#3604)
    • sync: improve Mutex FIFO explanation (#3615)
    • timer: fix double newline in module docs (#3617)
    Open source →
  21. 1.3.0 07 Jul 2021
    Release notes
    • macros: don't trigger clippy::unwrap_used (#3926)
    Open source →
    Release notes

    Added

    • coop: expose an unconstrained() opt-out (#3547)
    • net: add into_std for net types without it (#3509)
    • sync: add same_channel method to mpsc::Sender (#3532)
    • sync: add {try_,}acquire_many_owned to Semaphore (#3535)
    • sync: add back RwLockWriteGuard::map and RwLockWriteGuard::try_map (#3348)

    Fixed

    • sync: allow oneshot::Receiver::close after successful try_recv (#3552)
    • time: do not panic on timeout(Duration::MAX) (#3551)

    Documented

    • doc: doc aliases for pre-1.0 function names (#3523)
    • io: fix typos (#3541)
    • io: note the EOF behavior of read_until (#3536)
    • io: update AsyncRead::poll_read doc (#3557)
    • net: update UdpSocket splitting doc (#3517)
    • runtime: add link to LocalSet on new_current_thread (#3508)
    • runtime: update documentation of thread limits (#3527)
    • sync: do not recommend join_all for Barrier (#3514)
    • sync: documentation for oneshot (#3592)
    • sync: rename notify to notify_one (#3526)
    • time: fix typo in Sleep doc (#3515)
    • time: sync interval.rs and time/mod.rs docs (#3533)
    Open source →
  22. 1.2.0 14 May 2021
    Release notes
    • macros: forward input arguments in #[tokio::test] (#3691)
    • macros: improve diagnostics on type mismatch (#3766)
    • macros: various error message improvements (#3677)
    Open source →
    Release notes

    Added

    • signal: make Signal::poll_recv method public (#3383)

    Fixed

    • time: make test-util paused time fully deterministic (#3492)

    Documented

    • sync: link to new broadcast and watch wrappers (#3504)
    Open source →
  23. 1.1.0 05 Feb 2021
    Release notes
    • add start_paused option to macros ([#3492])
    Open source →
    Release notes

    Added

    • net: add try_read_buf and try_recv_buf (#3351)
    • mpsc: Add Sender::try_reserve function (#3418)
    • sync: add RwLock try_read and try_write methods (#3400)
    • io: add ReadBuf::inner_mut (#3443)

    Changed

    • macros: improve select! error message (#3352)
    • io: keep track of initialized bytes in read_to_end (#3426)
    • runtime: consolidate errors for context missing (#3441)

    Fixed

    • task: wake LocalSet on spawn_local (#3369)
    • sync: fix panic in broadcast::Receiver drop (#3434)

    Documented

    • stream: link to new Stream wrappers in tokio-stream (#3343)
    • docs: mention that test-util feature is not enabled with full (#3397)
    • process: add documentation to process::Child fields (#3437)
    • io: clarify AsyncFd docs about changes of the inner fd (#3430)
    • net: update datagram docs on splitting (#3448)
    • time: document that Sleep is not Unpin (#3457)
    • sync: add link to PollSemaphore (#3456)
    • task: add LocalSet example (#3438)
    • sync: improve bounded mpsc documentation (#3458)
    Open source →
  24. 1.0.0 23 Dec 2020
    Release notes
    • track tokio 1.0 release.
    Open source →
    Release notes

    Commit to the API and long-term support.

    Fixed

    • sync: spurious wakeup in watch (#3234).

    Changed

    • io: rename AsyncFd::with_io() to try_io() (#3306)
    • fs: avoid OS specific *Ext traits in favor of conditionally defining the fn (#3264).
    • fs: Sleep is !Unpin (#3278).
    • net: pass SocketAddr by value (#3125).
    • net: TcpStream::poll_peek takes ReadBuf (#3259).
    • rt: rename runtime::Builder::max_threads() to max_blocking_threads() (#3287).
    • time: require current_thread runtime when calling time::pause() (#3289).

    Removed

    • remove tokio::prelude (#3299).
    • io: remove AsyncFd::with_poll() (#3306).
    • net: remove {Tcp,Unix}Stream::shutdown() in favor of AsyncWrite::shutdown() (#3298).
    • stream: move all stream utilities to tokio-stream until Stream is added to std (#3277).
    • sync: mpsc try_recv() due to unexpected behavior (#3263).
    • tracing: make unstable as tracing-core is not 1.0 yet (#3266).

    Added

    • fs: poll_* fns to DirEntry (#3308).
    • io: poll_* fns to io::Lines, io::Split (#3308).
    • io: _mut method variants to AsyncFd (#3304).
    • net: poll_* fns to UnixDatagram (#3223).
    • net: UnixStream readiness and non-blocking ops (#3246).
    • sync: UnboundedReceiver::blocking_recv() (#3262).
    • sync: watch::Sender::borrow() (#3269).
    • sync: Semaphore::close() (#3065).
    • sync: poll_recv fns to mpsc::Receiver, mpsc::UnboundedReceiver (#3308).
    • time: poll_tick fn to time::Interval (#3316).
    Open source →
  25. 0.3.2 19 Dec 2020
    Release notes

    Adds AsyncFd as a replacement for v0.2's PollEvented.

    Fixed

    • io: fix a potential deadlock when shutting down the I/O driver (#2903).
    • sync: RwLockWriteGuard::downgrade() bug (#2957).

    Added

    • io: AsyncFd for receiving readiness events on raw FDs (#2903).
    • net: poll_* function on UdpSocket (#2981).
    • net: UdpSocket::take_error() (#3051).
    • sync: oneshot::Sender::poll_closed() (#3032).
    Open source →
  26. 0.3.1 26 Oct 2020
    Release notes

    Fixed

    • fix incorrect docs regarding max_threads option ([#3038])
    Open source →
    Release notes

    This release fixes an use-after-free in the IO driver. Additionally, the read_buf and write_buf methods have been added back to the IO traits, as the bytes crate is now on track to reach version 1.0 together with Tokio.

    Fixed

    • net: fix use-after-free (#3019).
    • fs: ensure buffered data is written on shutdown (#3009).

    Added

    • io: copy_buf() (#2884).
    • io: AsyncReadExt::read_buf(), AsyncReadExt::write_buf() for working with Buf/BufMut (#3003).
    • rt: Runtime::spawn_blocking() (#2980).
    • sync: watch::Sender::is_closed() (#2991).
    Open source →
  27. 0.3.0 15 Oct 2020
    Release notes
    • Track tokio 0.3 release.

    Changed

    • options are renamed to track tokio runtime builder fn names.
    • #[tokio::main] macro requires rt-multi-thread when no flavor is specified.
    Open source →
    Release notes

    This represents a 1.0 beta release. APIs are polished and future-proofed. APIs not included for 1.0 stabilization have been removed.

    Biggest changes are:

    • I/O driver internal rewrite. The windows implementation includes significant changes.
    • Runtime API is polished, especially with how it interacts with feature flag combinations.
    • Feature flags are simplified
      • rt-core and rt-util are combined to rt
      • rt-threaded is renamed to rt-multi-thread to match builder API
      • tcp, udp, uds, dns are combined to net.
      • parking_lot is included with full

    Changes

    • meta: Minimum supported Rust version is now 1.45.
    • io: AsyncRead trait now takes ReadBuf in order to safely handle reading into uninitialized memory (#2758).
    • io: Internal I/O driver storage is now able to compact (#2757).
    • rt: Runtime::block_on now takes &self (#2782).
    • sync: watch reworked to decouple receiving a change notification from receiving the value (#2814, #2806).
    • sync: Notify::notify is renamed to notify_one (#2822).
    • process: Child::kill is now an async fn that cleans zombies (#2823).
    • sync: use const fn constructors as possible (#2833, #2790)
    • signal: reduce cross-thread notification (#2835).
    • net: tcp,udp,uds types support operations with &self (#2828, #2919, #2934).
    • sync: blocking mpsc channel supports send with &self (#2861).
    • time: rename delay_for and delay_until to sleep and sleep_until (#2826).
    • io: upgrade to mio 0.7 (#2893).
    • io: AsyncSeek trait is tweaked (#2885).
    • fs: File operations take &self (#2930).
    • rt: runtime API, and #[tokio::main] macro polish (#2876)
    • rt: Runtime::enter uses an RAII guard instead of a closure (#2954).
    • net: the from_std function on all sockets no longer sets socket into non-blocking mode (#2893)

    Added

    • sync: map function to lock guards (#2445).
    • sync: blocking_recv and blocking_send fns to mpsc for use outside of Tokio (#2685).
    • rt: Builder::thread_name_fn for configuring thread names (#1921).
    • fs: impl FromRawFd and FromRawHandle for File (#2792).
    • process: Child::wait and Child::try_wait (#2796).
    • rt: support configuring thread keep-alive duration (#2809).
    • rt: task::JoinHandle::abort forcibly cancels a spawned task (#2474).
    • sync: RwLock write guard to read guard downgrading (#2733).
    • net: add poll_* functions that take &self to all net types (#2845)
    • sync: get_mut() for Mutex, RwLock (#2856).
    • sync: mpsc::Sender::closed() waits for Receiver half to close (#2840).
    • sync: mpsc::Sender::is_closed() returns true if Receiver half is closed (#2726).
    • stream: iter and iter_mut to StreamMap (#2890).
    • net: implement AsRawSocket on windows (#2911).
    • net: TcpSocket creates a socket without binding or listening (#2920).

    Removed

    • io: vectored ops are removed from AsyncRead, AsyncWrite traits (#2882).
    • io: mio is removed from the public API. PollEvented and Registration are removed (#2893).
    • io: remove bytes from public API. Buf and BufMut implementation are removed (#2908).
    • time: DelayQueue is moved to tokio-util (#2897).

    Fixed

    • io: stdout and stderr buffering on windows (#2734).
    Open source →
  28. 0.2.6 11 Nov 2020
    Release notes

    Fixes

    • fs::File::seek API regression (#1991).
    Open source →
  29. 0.2.5 27 Feb 2020
    Release notes

    Fixed

    • doc improvements ([#2225]).
    Open source →
    Release notes

    Added

    • io::AsyncSeek trait (#1924).
    • Mutex::try_lock (#1939)
    • mpsc::Receiver::try_recv and mpsc::UnboundedReceiver::try_recv (#1939).
    • writev support for TcpStream (#1956).
    • time::throttle for throttling streams (#1949).
    • implement Stream for time::DelayQueue (#1975).
    • sync::broadcast provides a fan-out channel (#1943).
    • sync::Semaphore provides an async semaphore (#1973).
    • stream::StreamExt provides stream utilities (#1962).

    Fixes

    • deadlock risk while shutting down the runtime (#1972).
    • panic while shutting down the runtime (#1978).
    • sync::MutexGuard debug output (#1961).
    • misc doc improvements (#1933, #1934, #1940, #1942).

    Changes

    • runtime threads are configured with runtime::Builder::core_threads and runtime::Builder::max_threads. runtime::Builder::num_threads is deprecated (#1977).
    Open source →
  30. 0.2.4 27 Jan 2020
    Release notes

    Fixed

    • generics on #[tokio::main] function ([#2177]).

    Added

    • support for tokio::select! ([#2152]).
    Open source →
    Release notes

    Fixes

    • sync::Mutex deadlock when lock() future is dropped early (#1898).
    Open source →
  31. 0.2.3 07 Jan 2020
    Release notes

    Fixed

    • Revert breaking change.
    Open source →
    Release notes

    Added

    • read / write integers using AsyncReadExt and AsyncWriteExt (#1863).
    • read_buf / write_buf for reading / writing Buf / BufMut (#1881).
    • TcpStream::poll_peek - pollable API for performing TCP peek (#1864).
    • sync::oneshot::error::TryRecvError provides variants to detect the error kind (#1874).
    • LocalSet::block_on accepts !'static task (#1882).
    • task::JoinError is now Sync (#1888).
    • impl conversions between tokio::time::Instant and std::time::Instant (#1904).

    Fixes

    Open source →
  32. 0.2.2 07 Jan 2020 withdrawn
    Release notes

    Added

    • General refactoring and inclusion of additional runtime options ([#2022] and [#2038])
    Open source →
    Release notes

    Fixes

    • scheduling with basic_scheduler (#1861).
    • update spawn panic message to specify that a task scheduler is required (#1839).
    • API docs example for runtime::Builder to include a task scheduler (#1841).
    • general documentation (#1834).
    • building on illumos/solaris (#1772).
    • panic when dropping LocalSet (#1843).
    • API docs mention the required Cargo features for Builder::{basic, threaded}_scheduler (#1858).

    Added

    • impl Stream for signal::unix::Signal (#1849).
    • API docs for platform specific behavior of signal::ctrl_c and signal::unix::Signal (#1854).
    • API docs for signal::unix::Signal::{recv, poll_recv} and signal::windows::CtrlBreak::{recv, poll_recv} (#1854).
    • File::into_std and File::try_into_std methods (#1856).
    Open source →
  33. 0.2.1 18 Dec 2019
    Release notes

    Fixes

    • inherit visibility when wrapping async fn ([#1954]).
    Open source →
    Release notes

    Fixes

    • API docs for TcpListener::incoming, UnixListener::incoming (#1831).

    Added

    • tokio::task::LocalSet provides a strategy for spawning !Send tasks (#1733).
    • export tokio::time::Elapsed (#1826).
    • impl AsRawFd, AsRawHandle for tokio::fs::File (#1827).
    Open source →
  34. 0.2.0 26 Nov 2019
    Release notes
    • Initial release
    Open source →
    Release notes

    A major breaking change. Most implementation and APIs have changed one way or another. This changelog entry contains a highlight

    Changed

    • APIs are updated to use async / await.
    • most tokio-* crates are collapsed into this crate.
    • Scheduler is rewritten.
    • tokio::spawn returns a JoinHandle.
    • A single I/O / timer is used per runtime.
    • I/O driver uses a concurrent slab for allocating state.
    • components are made available via feature flag.
    • Use bytes 0.5
    • tokio::codec is moved to tokio-util.

    Removed

    • Standalone timer and net drivers are removed, use Runtime instead
    • current_thread runtime is removed, use tokio::runtime::Runtime with basic_scheduler instead.
    Open source →
  35. 0.2.0-alpha.6 01 Oct 2019 pre-release

    Nothing published for this version

  36. 0.2.0-alpha.5 19 Sep 2019 pre-release

    Nothing published for this version

  37. 0.2.0-alpha.4 29 Aug 2019 pre-release

    Nothing published for this version

  38. 0.2.0-alpha.3 28 Aug 2019 pre-release

    Nothing published for this version

  39. 0.2.0-alpha.2 18 Aug 2019 pre-release

    Nothing published for this version

  40. 0.2.0-alpha.1 08 Aug 2019 pre-release

    Nothing published for this version

  41. 0.0.0 24 Apr 2019

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive