Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically document feature flag requirements on docs.rs by using the feature doc_auto_cfg #266

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JSorngard
Copy link

@JSorngard JSorngard commented Jun 9, 2024

Thanks for the nice crate!

Since this is an unsolicited PR, I completely understand if it is not interesting.

This PR automatically documents all feature flag requirements on docs.rs. This way any future feature flag gated code does not have to worry about documenting what features it needs. It uses the idea discussed in this stackoverflow post.

The feature requires a nightly compiler, but by conditionally enabling it only on docs.rs the MSRV of the crate is unchanged (docs.rs always uses the nightly compiler).

The result should look like this:
bild
and this:
bild

To test it locally you can do

RUSTDOCFLAGS="--cfg docsrs"; cargo +nightly doc --all-features

on Linux, and

$env:RUSTDOCFLAGS="--cfg docsrs"
cargo +nightly doc --all-features

on Windows.

Cargo.toml Outdated Show resolved Hide resolved
@bluss
Copy link
Owner

bluss commented Jul 31, 2024

That looks very good but right now, with the slow speed of development, I don't want to use any unstable features.

@JSorngard
Copy link
Author

Ah, I hadn't seen that! Very nice.

Makes sense to not merge. Should I delete the PR, or is it something for the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants