From 923abdd7f9c26c85069cf92dda5cc389da6ab2e9 Mon Sep 17 00:00:00 2001 From: Mark Karpeles Date: Mon, 15 Jun 2026 23:24:46 +0900 Subject: [PATCH] fix: docs.rs build + add docs.rs-config CI job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The crate root lacked `#![cfg_attr(docsrs, feature(doc_cfg))]`, which the per-module `#[cfg_attr(docsrs, doc(cfg(...)))]` labels require. docs.rs builds on nightly with `--cfg docsrs`, so it failed with E0658 (`#[doc(cfg)]` is experimental) — while the stable `docs` CI job (no `--cfg docsrs`, labels inert) passed, hiding the breakage until publish. - Add the crate-root feature gate (docsrs-only; stable builds unaffected). - Add a `docsrs` CI job that builds the docs exactly as docs.rs does (nightly + `--cfg docsrs`, warnings denied) so the gap can't recur. Co-Authored-By: Claude Fable 5 --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ CHANGELOG.md | 10 ++++++++++ src/lib.rs | 9 +++++++++ 3 files changed, 42 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c933d86..6745757 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,3 +103,26 @@ jobs: - name: cargo doc --no-deps --all-features run: cargo doc --no-deps --all-features + + docsrs: + name: Docs build (docs.rs config) + runs-on: ubuntu-latest + env: + # Mirror the docs.rs build environment so a docs.rs-only failure is + # caught here rather than only after publishing. docs.rs builds on + # nightly and passes `--cfg docsrs` (see [package.metadata.docs.rs] in + # Cargo.toml); the plain `docs` job above runs on stable without + # `--cfg docsrs`, so the `#[cfg_attr(docsrs, doc(cfg(...)))]` labels are + # inert there and a missing crate-root `feature(doc_cfg)` slips through. + RUSTDOCFLAGS: --cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links + steps: + - uses: actions/checkout@v6 + + - name: Install Rust (nightly, as docs.rs uses) + uses: dtolnay/rust-toolchain@nightly + + - name: Cache + uses: Swatinem/rust-cache@v2 + + - name: cargo doc --no-deps --all-features (docs.rs config) + run: cargo doc --no-deps --all-features diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c19c5c..7632b4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **docs.rs build**: add the crate-root `#![cfg_attr(docsrs, feature(doc_cfg))]` + that the crate's per-module `#[cfg_attr(docsrs, doc(cfg(...)))]` labels + require. Without it the docs.rs build (nightly + `--cfg docsrs`) failed with + E0658, even though the plain stable `cargo doc` CI job — where `docsrs` is + unset and the attributes are inert — passed. A new CI job (`docsrs`) now + builds the docs the way docs.rs does (nightly + `--cfg docsrs`, warnings + denied) so this gap is caught before publishing. + +### Fixed + - *(cli)* `compcol -d` no longer truncates highly-compressible large inputs. The streaming decode loop stopped once the compressed input was consumed, leaving output a block-buffering decoder (notably bzip2) still held diff --git a/src/lib.rs b/src/lib.rs index 1b986af..8c3aa0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,15 @@ #![no_std] #![forbid(unsafe_code)] +// Enable the nightly `doc_cfg` feature when building the docs.rs doc set +// (docs.rs passes `--cfg docsrs`). Modules across the crate carry +// `#![cfg_attr(docsrs, doc(cfg(feature = "...")))]` to label which feature +// each item needs; those `#[doc(cfg(...))]` attributes are experimental and +// require this crate-level `feature(doc_cfg)`. Without it, the docs.rs build +// (nightly + `--cfg docsrs`) fails with E0658 even though a plain stable +// `cargo doc` — where `docsrs` is unset and the attributes are inert — +// succeeds. Gated on `docsrs` so stable builds never see the nightly feature. +#![cfg_attr(docsrs, feature(doc_cfg))] #[cfg(feature = "alloc")] extern crate alloc;