Conversation
There was a problem hiding this comment.
Thank you for a lot of careful work on this thing!
utACK, even if there are valid Nits in my comments, they can be addressed later in a separate PR, since any improvements to the docs exposing the items behind feature gates are better than nothing.
Two main comments:
- Seems like we need to re-base onto master to take into account all changes in feature use from no_std 0.27 version (or do a follow-up PR to this one)
- I will test this locally if all of the existing feature gates are exposed to docs once all of the commits in PR will pass CI and compile: @apoelstra usually puts this as a requirement for merging any PR into the rust-bitcoin. You can see more in PR #587, where I also had included the test script
src/lib.rs
Outdated
There was a problem hiding this comment.
Seems we are missing alloc feature here, introduced by recent PR.
There was a problem hiding this comment.
You mean no-std which is documented below? I don't see any alloc PR.
There was a problem hiding this comment.
Right, I mixed up with bitcoin_hashes which does have
src/util/amount.rs
Outdated
There was a problem hiding this comment.
Finally somebody started introducing practice of [`Type`] instead of [Type]
src/util/misc.rs
Outdated
There was a problem hiding this comment.
Not sure why we have a feature gate here, when we anyway re-export them into public space above via a feature-gated export
There was a problem hiding this comment.
TBH, I somewhat blindly added the attribute to each instance of #[cfg] I ripgreped. I could remove it but I'm also thinking keeping it may be good way to avoid accidentally messing up in refactors.
src/util/misc.rs
Outdated
src/util/psbt/mod.rs
Outdated
There was a problem hiding this comment.
Should't we just feature-gate the mod itself and not specific impls?
There was a problem hiding this comment.
I'm not sure rustdoc is that smart and it will do what we want. I could check later.
src/util/psbt/mod.rs
Outdated
src/util/psbt/mod.rs
Outdated
|
Squashed commits. |
src/blockdata/script.rs
Outdated
There was a problem hiding this comment.
Lol whoops, we definitely should not have feature-gated enum variants. Surprised nobody has complained about this.
Looks like Tamás and I did this in March 2018.
Nothing to do with this PR but we should fix it in another one.
There was a problem hiding this comment.
Yeah, for normal enums that'd be breaking because some crate could do exhaustive match on it while other crate turns on the feature. I think it'd be fine for #[non_exhaustive] enums.
apoelstra
left a comment
There was a problem hiding this comment.
ACK 1e766d22b4c1bd6f080c7a35274ebd05953e44b6
Thank you for all this work! I would appreciate a fix for the typo but won't hold up merging for it.
1e766d2 to
0670bda
Compare
dr-orlovsky
left a comment
There was a problem hiding this comment.
utACK 0670bdaef490ea100ab4dfb2b7ade829f66a67be
|
Needs rebase |
This documents cargo features in two ways: explictly in text and in code using `#[doc(cfg(...))]` attribute where possible. Notably, this is impossible for `serde` derives. The attribute is contitional and only activated for docs.rs or explicit local builds. This change also adds `package.metadata.docs.rs` field to `Cargo.toml` which instructs docs.rs to build with relevant features and with `docsrs` config activated enabling `#[doc(cfg(...))] attributes. I also took the opportunity to fix a few missing spaces in nearby code.
0670bda to
95fb4e0
Compare
|
Done. |
|
Hmm, GH notified me that there was a fail but I don't see it here. The failure is a fluke (failed to download Rust). |
18f74d5 Clarify what does "less security" mean (Martin Habovstiak) 94c55b4 Fixed typos/grammar mistakes (Martin Habovštiak) 1bf0552 Documented features (Martin Habovstiak) Pull request description: This documents the Cargo features making sure docs.rs shows warning for feature-gated items. They are also explicitly spelled out in the crate documentation. The PR is similar in spirit to rust-bitcoin/rust-bitcoin#633 ACKs for top commit: apoelstra: ACK 18f74d5 Tree-SHA512: 8aac3fc5fd8ee887d6b13606d66b3d11ce44662afb92228c4f8da6169e3f70ac6a005b328f427a91d307f8d36d091dcf24bfe4d17dfc034d02b578258719a90a
…error 50db03c cargo fmt (Andrew Poelstra) 220f101 ci: screw up imports for rust-lang/rust#121684 (Andrew Poelstra) df069af ci: remove unnecessary imports of `bitcoin` (Andrew Poelstra) 3725549 ci: tighten import of `Vec` (Andrew Poelstra) d441ccd ci: remove imports that are redundant with super::* (Andrew Poelstra) b87b4fb remove sketchy `LikelyFalse` error (Andrew Poelstra) Pull request description: This error would trigger on `l:0` on the basis that this is equivalent to `u:0` but always less efficient. There are no other "linting" errors like this in this library, and the C++ implementation doesn't have it, so we should drop it. Fixes rust-bitcoin#633 ACKs for top commit: tcharding: ACK 50db03c sanket1729: ACK 50db03c Tree-SHA512: 30681e6abe7957b9fbe059e808d8057fd174ea156d1853960370d2fd63b032a500f85965a5c7424764df76ed804c62d9a781ae38cdc2b123e9b4b53308dd89f5
18f74d52422fc18f0e4c866203d7aa12c8faa3f9 Clarify what does "less security" mean (Martin Habovstiak) 94c55b4d09727433c606301d27173748c8ff36df Fixed typos/grammar mistakes (Martin Habovštiak) 1bf05523f072f833f388a1fe5e5d538fd00119c8 Documented features (Martin Habovstiak) Pull request description: This documents the Cargo features making sure docs.rs shows warning for feature-gated items. They are also explicitly spelled out in the crate documentation. The PR is similar in spirit to rust-bitcoin/rust-bitcoin#633 ACKs for top commit: apoelstra: ACK 18f74d52422fc18f0e4c866203d7aa12c8faa3f9 Tree-SHA512: 8aac3fc5fd8ee887d6b13606d66b3d11ce44662afb92228c4f8da6169e3f70ac6a005b328f427a91d307f8d36d091dcf24bfe4d17dfc034d02b578258719a90a
18f74d52422fc18f0e4c866203d7aa12c8faa3f9 Clarify what does "less security" mean (Martin Habovstiak) 94c55b4d09727433c606301d27173748c8ff36df Fixed typos/grammar mistakes (Martin Habovštiak) 1bf05523f072f833f388a1fe5e5d538fd00119c8 Documented features (Martin Habovstiak) Pull request description: This documents the Cargo features making sure docs.rs shows warning for feature-gated items. They are also explicitly spelled out in the crate documentation. The PR is similar in spirit to rust-bitcoin/rust-bitcoin#633 ACKs for top commit: apoelstra: ACK 18f74d52422fc18f0e4c866203d7aa12c8faa3f9 Tree-SHA512: 8aac3fc5fd8ee887d6b13606d66b3d11ce44662afb92228c4f8da6169e3f70ac6a005b328f427a91d307f8d36d091dcf24bfe4d17dfc034d02b578258719a90a
This documents cargo features in two ways: explictly in text and in code
using
#[doc(cfg(...))]attribute where possible. Notably, this isimpossible for
serdederives. The attribute is contitional and onlyactivated for docs.rs or explicit local builds.
This change also adds
package.metadata.docs.rsfield toCargo.tomlwhich instructs docs.rs to build with relevant features and with
docsrsconfig activated enabling `#[doc(cfg(...))] attributes.I also took the opportunity to fix a few missing spaces in nearby code.
Notes for reviewers:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features std,secp-recovery,base64,rand,use-serde,bitcoinconsensus --open(don't confuseRUSTDOCFLAGSwithRUSTFLAGS- took me a while to figure that out 😞)Script::verify