From 0e3ffc7e774e0007718f615fa0da9897d4f8818c Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 21 Jan 2024 17:58:13 +0100 Subject: [PATCH] Fix `cargo docs` and use `--cfg docsrs` in CI --- .cargo/config.toml | 10 +++++++++- .github/workflows/ci.yml | 2 +- crates/teloxide/Cargo.toml | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 8fe98bda..995e7435 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,6 +3,8 @@ # https://github.com/rust-lang/cargo/issues/10333 # # "tokio/macros" and "tokio/rt-multi-thread" are required for examples +# +# N.B.: when changing this, also change `package.metadata.docs.rs` docs = """doc -Zrustdoc-scrape-examples --features=full --features=nightly @@ -11,4 +13,10 @@ docs = """doc [build] # We pass "--cfg docsrs" when building docs to add `This is supported on feature="..." only.` -rustdocflags = ["--cfg", "docsrs", "-Znormalize-docs"] +# +# FIXME: add back `-Znormalize-docs` once is fixed +# or we don't depend on `generic-array` anymore +# +# N.B.: when changing this, also change `RUSTDOCFLAGS` in `.github/workflows/ci.yml` and +# `package.metadata.docs.rs.rustdoc-args` in `crates/teloxide/Cargo.toml` +rustdocflags = ["--cfg", "docsrs"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d6d70fa..a3f20a57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ name: Continuous integration env: RUSTFLAGS: "--cfg CI_REDIS -Dwarnings" - RUSTDOCFLAGS: -Dwarnings + RUSTDOCFLAGS: "--cfg docsrs -Dwarnings" RUST_BACKTRACE: short CARGO_INCREMENTAL: 0 diff --git a/crates/teloxide/Cargo.toml b/crates/teloxide/Cargo.toml index bf698114..c3e445c5 100644 --- a/crates/teloxide/Cargo.toml +++ b/crates/teloxide/Cargo.toml @@ -129,7 +129,6 @@ tokio-stream = "0.1" [package.metadata.docs.rs] # NB: can't use `all-features = true`, because `sqlite-storage-nativetls` conflicts with `sqlite-storage-rustls` features = ["full", "nightly"] -# FIXME: Add back "-Znormalize-docs" when https://github.com/rust-lang/rust/issues/93703 is fixed rustdoc-args = ["--cfg", "docsrs"] rustc-args = ["--cfg", "dep_docsrs"] cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]