-
Notifications
You must be signed in to change notification settings - Fork 436
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
enable doc_auto_cfg to show feature-req-hint in docs.rs #2271
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2271 +/- ##
==========================================
- Coverage 85.79% 85.41% -0.39%
==========================================
Files 754 767 +13
Lines 95189 97960 +2771
==========================================
+ Hits 81671 83669 +1998
- Misses 13518 14291 +773 ☔ View full report in Codecov by Sentry. |
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.
e33e3f9
to
7b8a75e
Compare
I'll try to fix this. I guess it is because features like |
I found a way to fix this, and now it works for I have compared the new doc page and the old, and I think nothing lost. I hope I didn't forget exporting something. |
8ea0775
to
a99d7e8
Compare
That seems a little error prone 😅 would be nice if there was a way to do this properly without re-exporting |
I hope so. I found current less graceful solution by a minimal example. I'll try asking for help from the feature developper and the community. |
I just found this is allowed: pub use crate_a::*; // instead of `pub use crate_a::{B, C, D, ...}
#[cfg(feature = "a")]
pub use crate_a::A; Now it will be less possible to make a mistake. By the way, as the features are given in the The features are written in And I found there are also many problems about features in this repo. For example, my editor told me |
e55508e
to
8c20fac
Compare
@kingwingfly When building an example from the root workspace directory, all dependencies listed in the workspace are built, not one the ones specified in the example. I though this was a cargo workspace thing, is there a way to remove that behavior? |
Using required-feature can solve this problem. But it then needs to modify test and example shell scripts to enable features needed. |
crates/burn/src/lib.rs
Outdated
pub use burn_train::metric::{ | ||
CpuMemory, CpuTemperature, CpuUse, CudaMetric, TopKAccuracyInput, TopKAccuracyMetric, | ||
}; |
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 don't like the fact we need to know when adding a new metrics, that it should be manually re-exported in the burn root crate. Only for the feature flag to show on the docs :/
Pull Request Template
Checklist
run-checks all
script has been executed.Related Issues/PRs
None
Changes
According to this,
cargo doc
has an cool featuredoc_auto_cfg
, which helps show the features-required hints liketokio
.Apart from that, I also add
documentation
keys in[package]
.Testing
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features doc --no-deps -p burn --open
I just checked that it works and show things like:
But I don't know how to automize this with xtask, and it needs nightly Rust as the version used by docs.rs.