-
Notifications
You must be signed in to change notification settings - Fork 134
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
Use #[cfg(doc)]
instead of docs.rs-specific cfg flag
#287
Conversation
Cargo.toml
Outdated
[package.metadata.docs.rs] | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to pass --cfg docsrs
when building for docs.rs. This is so we can enable the doc_cfg
feature, allowing us to note which features are required for which functions. For example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just decided to add a doc_cfg
nightly-only feature to handle this. Now running cargo doc
just does the right thing by default.
- name: "Run cargo doc" | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: doc | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do 3 runs of cargo doc
here:
cargo doc
- default flags, on nightly
RUSTDOCFLAGS="--cfg docsrs" cargo doc
- flags docs.rs will use, on nightly
cargo +stable doc --no-default-features --features=external_asm,instructions
- make sure we can build the docs with the stable compiler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to just have (1) and (3), now that we don't have the docsrs
stuff.
58202ef
to
e1e5f50
Compare
33b3c2c
to
a80a0cf
Compare
4048bab
to
b3db805
Compare
The documentation can also be built locally using `cargo doc --open`. Doc links should be working there as well.
Signed-off-by: Joe Richey <joerichey@google.com>
Signed-off-by: Joe Richey <joerichey@google.com>
b3db805
to
5354b02
Compare
Great, thanks a lot for your improvements! |
The documentation can also be built locally using
cargo doc --open
. Doc links should be working there as well.