Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: list: hide macros from top-level kernel doc

Due to Rust macro scoping rules, all macros defined in a crate using
`#[macro_export]` end up in the top-level. For the list macros, we
re-export them inside the list module, and expect users to use
`kernel::list::macro_name!()`.

Use `#[doc(hidden)]` on the macro definition, and use `#[doc(inline)]` on
the re-export to make the macro appear to be defined at module-level inside
documentation.

The other exported types are already automatically `#[doc(inline)]` because
they are defined in a non-public module, so there is no need to split the
macro re-exports out.

Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260312174700.4016015-1-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Gary Guo and committed by
Miguel Ojeda
d58f0f14 9bf32bc6

+24 -3
+19 -3
rust/kernel/list.rs
··· 12 12 use pin_init::PinInit; 13 13 14 14 mod impl_list_item_mod; 15 + #[doc(inline)] 15 16 pub use self::impl_list_item_mod::{ 16 - impl_has_list_links, impl_has_list_links_self_ptr, impl_list_item, HasListLinks, HasSelfPtr, 17 + impl_has_list_links, 18 + impl_has_list_links_self_ptr, 19 + impl_list_item, 20 + HasListLinks, 21 + HasSelfPtr, // 17 22 }; 18 23 19 24 mod arc; 20 - pub use self::arc::{impl_list_arc_safe, AtomicTracker, ListArc, ListArcSafe, TryNewListArc}; 25 + #[doc(inline)] 26 + pub use self::arc::{ 27 + impl_list_arc_safe, 28 + AtomicTracker, 29 + ListArc, 30 + ListArcSafe, 31 + TryNewListArc, // 32 + }; 21 33 22 34 mod arc_field; 23 - pub use self::arc_field::{define_list_arc_field_getter, ListArcField}; 35 + #[doc(inline)] 36 + pub use self::arc_field::{ 37 + define_list_arc_field_getter, 38 + ListArcField, // 39 + }; 24 40 25 41 /// A linked list. 26 42 ///
+1
rust/kernel/list/arc.rs
··· 82 82 /// [`AtomicTracker`]. However, it is also possible to defer the tracking to another struct 83 83 /// using also using this macro. 84 84 #[macro_export] 85 + #[doc(hidden)] 85 86 macro_rules! impl_list_arc_safe { 86 87 (impl$({$($generics:tt)*})? ListArcSafe<$num:tt> for $t:ty { untracked; } $($rest:tt)*) => { 87 88 impl$(<$($generics)*>)? $crate::list::ListArcSafe<$num> for $t {
+1
rust/kernel/list/arc_field.rs
··· 66 66 67 67 /// Defines getters for a [`ListArcField`]. 68 68 #[macro_export] 69 + #[doc(hidden)] 69 70 macro_rules! define_list_arc_field_getter { 70 71 ($pub:vis fn $name:ident(&self $(<$id:tt>)?) -> &$typ:ty { $field:ident } 71 72 $($rest:tt)*
+3
rust/kernel/list/impl_list_item_mod.rs
··· 29 29 30 30 /// Implements the [`HasListLinks`] trait for the given type. 31 31 #[macro_export] 32 + #[doc(hidden)] 32 33 macro_rules! impl_has_list_links { 33 34 ($(impl$({$($generics:tt)*})? 34 35 HasListLinks$(<$id:tt>)? ··· 75 74 76 75 /// Implements the [`HasListLinks`] and [`HasSelfPtr`] traits for the given type. 77 76 #[macro_export] 77 + #[doc(hidden)] 78 78 macro_rules! impl_has_list_links_self_ptr { 79 79 ($(impl$({$($generics:tt)*})? 80 80 HasSelfPtr<$item_type:ty $(, $id:tt)?> ··· 183 181 /// } 184 182 /// ``` 185 183 #[macro_export] 184 + #[doc(hidden)] 186 185 macro_rules! impl_list_item { 187 186 ( 188 187 $(impl$({$($generics:tt)*})? ListItem<$num:tt> for $self:ty {