From faf7ea6ca7a2c2b771a170104ac13b3a10680776 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 15 Jul 2021 01:05:49 +0200 Subject: [PATCH 1/2] rust: kernel: enable `doc_cfg` unstable feature Closes https://github.com/Rust-for-Linux/linux/issues/442. Suggested-by: Finn Behrens Signed-off-by: Miguel Ojeda --- rust/kernel/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index de910b00706e55..2ea43292639d44 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -20,6 +20,7 @@ const_panic, const_raw_ptr_deref, const_unreachable_unchecked, + doc_cfg, receiver_trait, try_reserve )] From b53d561e365bdd8ec9d6bb13db6de449f34da697 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 15 Jul 2021 01:42:26 +0200 Subject: [PATCH 2/2] rust: kernel: start using `doc_cfg` and `doc` As an example, use `doc(cfg(...))` and `cfg(doc)` to gate `sysctl`. Signed-off-by: Miguel Ojeda --- rust/kernel/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index 2ea43292639d44..745cc19b217fc5 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -64,7 +64,8 @@ pub mod random; mod static_assert; pub mod sync; -#[cfg(CONFIG_SYSCTL)] +#[cfg(any(CONFIG_SYSCTL, doc))] +#[doc(cfg(CONFIG_SYSCTL))] pub mod sysctl; pub mod io_buffer;