Skip to contentSkip to conversation

rust: doc: disable doc inlining for all prelude items

PATCH Applied Gary Guo 3 participants 3 messages Apr 20 – May 19 Rust

lore
Share & tools
lore

Gary Guo

author
#0 lore raw

PATCH 1/1 rust: doc: disable doc inlining for all prelude items

From: Gary Guo <[email protected]>

Somehow the rustdoc heuristics determined that a large chunk of the items found in prelude should have documentation inlined. This bloats the generate documentation size.

Also, for crates that optimize documentation with cfg(doc), as the documentation inlining makes use of the metadata compiled by just rustc, it will not pick up the cfg(doc) attributes from the inlined documentation. pin-init for example optimizes tuple/fn rendering using the nightly fake_variadic feature [1], but this is missing from the inlined version [2].

Thus, mark all prelude items as #[doc(no_inline)].

---
 rust/kernel/prelude.rs | 3 +++
 1 file changed, 3 insertions(+)
rust/kernel/prelude.rs +3 -0
index 44edf72a4a24..bcd4e7f90bc7 100644
@@ -22,6 +22,7 @@
     pin::Pin, //
 };
 
+#[doc(no_inline)]
 pub use ::ffi::{
     c_char,
     c_int,
@@ -47,6 +48,7 @@
     vtable, //
 };
 
+#[doc(no_inline)]
 pub use pin_init::{
     init,
     pin_data,
@@ -58,6 +60,7 @@
     Zeroable, //
 };
 
+#[doc(no_inline)]
 pub use super::{
     alloc::{
         flags::*,

base-commit: 1c7cc4904160c6fc6377564140062d68a3dc93a0

Signature · 1 line
2.51.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Gary Guo

From: Gary Guo <[email protected]>

Somehow the rustdoc heuristics determined that a large chunk of the items found in prelude should have documentation inlined. This bloats the generate documentation size.

Also, for crates that optimize documentation with cfg(doc), as the documentation inlining makes use of the metadata compiled by just rustc, it will not pick up the cfg(doc) attributes from the inlined documentation. pin-init for example optimizes tuple/fn rendering using the nightly fake_variadic feature [1], but this is missing from the inlined version [2].

Quoted 5 lines

Thus, mark all prelude items as #[doc(no_inline)].

Applied
#2 lore raw
In reply to Gary Guo
Quoted 14 lines · Gary Guo

From: Gary Guo <[email protected]>

Somehow the rustdoc heuristics determined that a large chunk of the items found in prelude should have documentation inlined. This bloats the generate documentation size.

Also, for crates that optimize documentation with cfg(doc), as the documentation inlining makes use of the metadata compiled by just rustc, it will not pick up the cfg(doc) attributes from the inlined documentation. pin-init for example optimizes tuple/fn rendering using the nightly fake_variadic feature [1], but this is missing from the inlined version [2].

Quoted 5 lines

Thus, mark all prelude items as #[doc(no_inline)].

Applied to rust-next -- thanks everyone!

[ Reworded for typo. - Miguel ]

Cheers,
Miguel