Repository navigation
fix(criterion): document the async API on docs.rs - #207
Conversation
[Low impact] This PR appears safe to merge. SummaryAdds docs.rs settings so
Reviews (1) · Last reviewed commit: "fix(criterion): document the async API o..." · Reviewed by Greptile |
Merging this PR will regress 4 benchmarks3 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
|
I would recommend you also add |
7dd2d13 to
dd256d5
Compare
- `Bencher::to_async` is gated behind the `async` feature, and docs.rs built the crate with default features only, so the async API was missing from the published docs. - Enable all async runtimes for the docs.rs build, like upstream Criterion.
- Enable `doc_cfg` under `docsrs` so rustdoc labels feature-gated items, e.g. `Bencher::to_async` as "Available on crate feature `async` only". - Hide the internal `codspeed` cfg from the labels: it selects between the two `compat_criterion` modules, and would otherwise mark every item as "Available on non-codspeed only".
- docs.rs builds with nightly, and `rustix` 0.37 no longer compiles there (`rustc_*` attributes are reserved). Both async docs builds pulled it in: `smol` 1 and the locked `async-std` 1.12 depend on `async-io` 1. - Bump the walltime fork to `smol` 2, as the compat crate already uses, and update `async-std` to 1.13 in the lockfile. Both now use `async-io` 2. - `smol` is not part of the public API: `SmolExecutor` only calls `smol::block_on`.
dd256d5 to
2e79217
Compare
Fixes COD-4302
Bencher::to_asyncwas missing from thecodspeed-criterion-compatdocs (reported in #6). The method still exists, but it is gated behind theasyncfeature, and docs.rs built the crate with default features only.[package.metadata.docs.rs]section as upstream Criterion, so docs.rs builds with all async runtimes enabled (async_futures,async_smol,async_std,async_tokio).doc_cfgunderdocsrs, so feature-gated items get an "Available on crate featureasynconly" badge. The internalcodspeedcfg is hidden from the badges; it only selects between the twocompat_criterionmodules and would otherwise mark every item as "non-codspeed only".smol2 and updateasync-stdto 1.13 in the lockfile. Both previously pulled inasync-io1 →rustix0.37, which no longer compiles on nightly (rustc_*attributes are reserved), so the async docs build would fail on docs.rs. This also fixes the fork's own docs.rs build, broken since 5.0.0.smolis not part of the public API (SmolExecutoronly callssmol::block_on), so this is not a breaking change.Verified locally:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc -p codspeed-criterion-compat -p codspeed-criterion-compat-walltime --no-depswith all async features passes (failed before the bump), andBenchershowsto_asyncwith theasyncfeature badge.cargo test -p codspeed-criterion-compat-walltime --libwith all async features passes.