mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00

* util: add track_caller to public APIs Functions that may panic can be annotated with `#[track_caller]` so that in the event of a panic, the function where the user called the panicking function is shown instead of the file and line within Tokio source. This change adds `#[track_caller]` to all the non-unstable public APIs in tokio-util where the documentation describes how the function may panic due to incorrect context or inputs. In one place, an assert was added where the described behavior appeared not to be implemented. The documentation for `DelayQueue::reserve` states that the function will panic if the new capacity exceeds the maximum number of entries the queue can contain. However, the function didn't panic until a higher number caused by an allocation failure. This is inconsistent with `DelayQueue::insert_at` which will panic if the number of entries were to go over MAX_ENTRIES. Tests are included to cover each potentially panicking function. Refs: #4413 * fix tests on FreeBSD 32-bit (I hope) Some tests were failing on FreeBSD 32-bit because the "times too far in the future" for DelayQueue were also too far in the future for the OS. Fixed by copying the MAX_DURATION value from where it's defined and using it to create a duration that is just 1 more than the maximum. This will start to break once we get close (within 2 and a bit years) of the Epochalypse (19 Jan, 2038) - but a lot of other things are going to be breaking on FreeBSD 32-bit by then anyway.
67 lines
2.0 KiB
TOML
67 lines
2.0 KiB
TOML
[package]
|
|
name = "tokio-util"
|
|
# When releasing to crates.io:
|
|
# - Remove path dependencies
|
|
# - Update CHANGELOG.md.
|
|
# - Create "tokio-util-0.7.x" git tag.
|
|
version = "0.7.3"
|
|
edition = "2018"
|
|
rust-version = "1.49"
|
|
authors = ["Tokio Contributors <team@tokio.rs>"]
|
|
license = "MIT"
|
|
repository = "https://github.com/tokio-rs/tokio"
|
|
homepage = "https://tokio.rs"
|
|
description = """
|
|
Additional utilities for working with Tokio.
|
|
"""
|
|
categories = ["asynchronous"]
|
|
|
|
[features]
|
|
# No features on by default
|
|
default = []
|
|
|
|
# Shorthand for enabling everything
|
|
full = ["codec", "compat", "io-util", "time", "net", "rt"]
|
|
|
|
net = ["tokio/net"]
|
|
compat = ["futures-io",]
|
|
codec = ["tracing"]
|
|
time = ["tokio/time","slab"]
|
|
io = []
|
|
io-util = ["io", "tokio/rt", "tokio/io-util"]
|
|
rt = ["tokio/rt", "tokio/sync", "futures-util", "hashbrown"]
|
|
|
|
__docs_rs = ["futures-util"]
|
|
|
|
[dependencies]
|
|
tokio = { version = "1.19.0", path = "../tokio", features = ["sync"] }
|
|
bytes = "1.0.0"
|
|
futures-core = "0.3.0"
|
|
futures-sink = "0.3.0"
|
|
futures-io = { version = "0.3.0", optional = true }
|
|
futures-util = { version = "0.3.0", optional = true }
|
|
pin-project-lite = "0.2.0"
|
|
slab = { version = "0.4.4", optional = true } # Backs `DelayQueue`
|
|
tracing = { version = "0.1.25", default-features = false, features = ["std"], optional = true }
|
|
|
|
[target.'cfg(tokio_unstable)'.dependencies]
|
|
hashbrown = { version = "0.12.0", optional = true }
|
|
|
|
[dev-dependencies]
|
|
tokio = { version = "1.0.0", path = "../tokio", features = ["full"] }
|
|
tokio-test = { version = "0.4.0", path = "../tokio-test" }
|
|
tokio-stream = { version = "0.1", path = "../tokio-stream" }
|
|
|
|
async-stream = "0.3.0"
|
|
futures = "0.3.0"
|
|
futures-test = "0.3.5"
|
|
parking_lot = "0.12.0"
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|
|
# enable unstable features in the documentation
|
|
rustdoc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable"]
|
|
# it's necessary to _also_ pass `--cfg tokio_unstable` to rustc, or else
|
|
# dependencies will not be enabled, and the docs build will fail.
|
|
rustc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable"]
|