-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Intradoc links are broken when building with no default features #162
Comments
So the direct HTML links were written that way because they were written well before intra doc links... Someone "just" has to go through and fix them. I'm aware of the first issue, which is that some links are broken when not all features are enabled. I don't know how to fix that. Unless there's some elegant solution, I think we just have to live with the warnings. |
for the broken links when not all features are enabled, I've been using a trick with //!
#![cfg_attr(
not(feature = "std"),
doc = "[`std`]: https://doc.rust-lang.org/std/index.html"
)]
#![cfg_attr(
not(feature = "std"),
doc = "[`std::error::Error`]: https://doc.rust-lang.org/std/error/trait.Error.html"
)]
#![cfg_attr(
not(feature = "alloc"),
doc = "[`alloc`]: https://doc.rust-lang.org/alloc/index.html"
)]
#![cfg_attr(feature = "alloc", doc = "[`String`]: alloc::string::String")]
#![cfg_attr(
not(feature = "alloc"),
doc = "[`String`]: https://doc.rust-lang.org/alloc/string/struct.String.html"
)]
#![cfg_attr(feature = "alloc", doc = "[`Vec`]: alloc::vec::Vec")]
#![cfg_attr(
not(feature = "alloc"),
doc = "[`Vec`]: https://doc.rust-lang.org/alloc/vec/struct.Vec.html"
)]
//! [Unicode case mapping]: https://unicode.org/faq/casemap_charprop.html#casemap
//! [conventionally UTF-8 binary strings]: https://docs.rs/bstr/0.2.*/bstr/#when-should-i-use-byte-strings |
It's a neat trick but I don't see myself doing that. Waaaaay too much work and way too messy. I would much rather just have warnings and broken links personally. |
bstr
has errors building documentation when doing so with--no-default-features
.Additionally, the vast majority of intra-doc linking in this crate is hardcoding links to HTML pages that rustdoc generates. Linking in this way prevents rustdoc from properly linting whether the items being referenced exist (which is especially nice in the presence of conditional compilation).
bstr/src/lib.rs
Lines 338 to 354 in b3cab19
Example links that are broken are this link to
BString
on theBStr
type docs:I've found adding this env var to CI and building the docs as part of the CI steps that test the feature matrix to be useful in preventing regressions here:
RUSTDOCFLAGS="-D warnings -D rustdoc::broken_intra_doc_links --cfg docsrs"
The text was updated successfully, but these errors were encountered: