-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
tldr: feature flag requirements (e.g. .diff()
requires the diff
feature) are showing up when I build docs locally and on GitHub Pages but not on docs.rs for some reason.
polars (rust) has a lot of feature flags, and I was having a little difficulty* figuring out which ones I was missing to get things to compile in polars-rust that I had working in polars-python. This led me to start a conversation on Reddit which helped me realize that:
- the official crates.io links to the docs.rs for documentation
- I've been using docs.rs as my polars reference as I learn
- the docs.rs doesn't show required feature flags whereas polar-rs.github.io does
- Other projects on docs.rs do show this: https://docs.rs/axum/latest/axum/trait.ServiceExt.html#tymethod.into_make_service_with_connect_info
I was wondering if there could perhaps be some kind of configuration on docs.rs or rustdoc that enables this, and was able to find:
- https://stackoverflow.com/questions/61417452/how-to-get-a-feature-requirement-tag-in-the-documentation-generated-by-cargo-do
- https://users.rust-lang.org/t/how-to-document-optional-features-in-api-docs/64577/3
Taking a look at your GA workflow, it builds locally with the feature flag requirements displayed: RUSTFLAGS="--cfg docsrs" cargo doc --features=docs-selection --package polars --open
.
Comparing to axum, I don't see huge differences for why their feature requirements are being displayed on docs.rs and polars is not, except that they are using all-features = true
where as polars uses features = ["docs-selection"]
in Cargo.toml
; building locally still shows the feature flag requirements, so that doesn't seem to be the issue.
Any ideas why the feature flag requirements aren't showing up on docs.rs?
* in spite of great documentation such as https://pola-rs.github.io/polars/polars/index.html#compile-times-and-opt-in-features