Fix cargo docs and use --cfg docsrs in CI

This commit is contained in:
Maybe Waffle 2024-01-21 17:58:13 +01:00
parent a233c3bcd0
commit 0e3ffc7e77
3 changed files with 10 additions and 3 deletions

View file

@ -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 <https://github.com/rust-lang/rust/issues/81091> 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"]

View file

@ -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

View file

@ -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"]