-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
cfg_attr(docsrs)
feature hints do not propagate to in kube
for re-exports
#1242
Comments
cfg_attr(docsrs)
feature hints do not propagate to in kube
for re-exports
One big thing (for me) is that feature flags aren't typechecked/isolated (for lack of a better word). Each combination of feature flags needs to be compiled/tested separately to make sure that it doesn't bitrot, while crates are isolated from each other by nature. |
https://blog.rust-lang.org/2023/08/24/Rust-1.72.0.html#rust-reports-potentially-useful-cfg-disabled-items-in-errors might make the re-export doc failures a bit better, haven't tested it yet. |
It is indeed much better now on 1.72. A way to test is to take out the default
|
Current and expected behavior
Currently we set up some very nice doc annotations for our optional features such as
ws
:kube/kube-client/src/api/remote_command.rs
Line 100 in bd14267
These show up perfectly on docs.rs/kube-client
However, on the facade crate docs.rs/kube it's less good.
This leads people to be confused because they are browsing docs.rs/kube and are being slightly lied to about feature choices as seen from continued confusion in comments from bugs like: #1159 (comment)
The problem arises because the
ws
feature flag is basically a kube-client and kube-core feature, and it's just propagated down into those crates. kube just re-exports everything it can find:kube/kube-client/src/lib.rs
Lines 69 to 109 in bd14267
Possible solution
Not sure exactly the best way forward here.
We could maybe try to explicitly namespace ws stuff better, but this is pretty insidious, and hard to retrofit without breaking a lot.
We could also perhaps consider importing the crates into a module workspace instead (merge the crates in one big crate). The need for having a multi-crate split is smaller these days with a locked versioning and re-exported features.
We could also just wait and hope docsrs gets better... It's not great that it doesn't detect this across crate boundaries, but it's also understandable, and probably hard. EDIT: yes. Open bug upstream rust-lang/rust#88743 . In a similar upstream bug, they do describe why it's hard: rust-lang/rust#83428 (comment)
Environment
docs.rs
The text was updated successfully, but these errors were encountered: