From: Benno Lossin Date: Sat, 8 Mar 2025 11:03:51 +0000 (+0000) Subject: rust: init: disable doctests X-Git-Tag: block-6.15-20250403~14^2~41 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=206dea39e55968d8f3ad56771507361eb799dfc7;p=linux-block.git rust: init: disable doctests The build system cannot handle doctests in the kernel crate in files outside of `rust/kernel/`. Subsequent commits will move files out of that directory, but will still compile them as part of the kernel crate. Thus ignore all doctests in the to-be-moved files. Leave tests disabled until they are separated into their own crate and they stop causing breakage. Signed-off-by: Benno Lossin Reviewed-by: Fiona Behrens Reviewed-by: Andreas Hindborg Tested-by: Andreas Hindborg Link: https://lore.kernel.org/r/20250308110339.2997091-2-benno.lossin@proton.me Signed-off-by: Miguel Ojeda --- diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index 7fd1ea8265a5..aa8df0595585 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -34,7 +34,7 @@ //! [`pin_init!`]. The syntax is almost the same as normal `struct` initializers. The difference is //! that you need to write `<-` instead of `:` for fields that you want to initialize in-place. //! -//! ```rust +//! ```rust,ignore //! # #![expect(clippy::disallowed_names)] //! use kernel::sync::{new_mutex, Mutex}; //! # use core::pin::Pin; @@ -54,7 +54,7 @@ //! `foo` now is of the type [`impl PinInit`]. We can now use any smart pointer that we like //! (or just the stack) to actually initialize a `Foo`: //! -//! ```rust +//! ```rust,ignore //! # #![expect(clippy::disallowed_names)] //! # use kernel::sync::{new_mutex, Mutex}; //! # use core::pin::Pin; @@ -78,7 +78,7 @@ //! Many types from the kernel supply a function/macro that returns an initializer, because the //! above method only works for types where you can access the fields. //! -//! ```rust +//! ```rust,ignore //! # use kernel::sync::{new_mutex, Arc, Mutex}; //! let mtx: Result>> = //! Arc::pin_init(new_mutex!(42, "example::mtx"), GFP_KERNEL); @@ -86,7 +86,7 @@ //! //! To declare an init macro/function you just return an [`impl PinInit`]: //! -//! ```rust +//! ```rust,ignore //! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init}; //! #[pin_data] //! struct DriverData { @@ -119,7 +119,7 @@ //! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of //! `slot` gets called. //! -//! ```rust +//! ```rust,ignore //! # #![expect(unreachable_pub, clippy::disallowed_names)] //! use kernel::{init, types::Opaque}; //! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin}; @@ -236,7 +236,7 @@ pub mod macros; /// /// # Examples /// -/// ```rust +/// ```rust,ignore /// # #![expect(clippy::disallowed_names)] /// # use kernel::{init, macros::pin_data, pin_init, stack_pin_init, init::*, sync::Mutex, new_mutex}; /// # use core::pin::Pin; @@ -382,7 +382,7 @@ macro_rules! stack_try_pin_init { /// /// The syntax is almost identical to that of a normal `struct` initializer: /// -/// ```rust +/// ```rust,ignore /// # use kernel::{init, pin_init, macros::pin_data, init::*}; /// # use core::pin::Pin; /// #[pin_data] @@ -426,7 +426,7 @@ macro_rules! stack_try_pin_init { /// /// To create an initializer function, simply declare it like this: /// -/// ```rust +/// ```rust,ignore /// # use kernel::{init, pin_init, init::*}; /// # use core::pin::Pin; /// # #[pin_data] @@ -452,7 +452,7 @@ macro_rules! stack_try_pin_init { /// /// Users of `Foo` can now create it like this: /// -/// ```rust +/// ```rust,ignore /// # #![expect(clippy::disallowed_names)] /// # use kernel::{init, pin_init, macros::pin_data, init::*}; /// # use core::pin::Pin; @@ -480,7 +480,7 @@ macro_rules! stack_try_pin_init { /// /// They can also easily embed it into their own `struct`s: /// -/// ```rust +/// ```rust,ignore /// # use kernel::{init, pin_init, macros::pin_data, init::*}; /// # use core::pin::Pin; /// # #[pin_data] @@ -539,7 +539,7 @@ macro_rules! stack_try_pin_init { /// /// For instance: /// -/// ```rust +/// ```rust,ignore /// # use kernel::{macros::{Zeroable, pin_data}, pin_init}; /// # use core::{ptr::addr_of_mut, marker::PhantomPinned}; /// #[pin_data] @@ -602,7 +602,7 @@ macro_rules! pin_init { /// /// # Examples /// -/// ```rust +/// ```rust,ignore /// use kernel::{init::{self, PinInit}, error::Error}; /// #[pin_data] /// struct BigBuf { @@ -705,7 +705,7 @@ macro_rules! init { /// /// # Examples /// -/// ```rust +/// ```rust,ignore /// use kernel::{alloc::KBox, init::{PinInit, zeroed}, error::Error}; /// struct BigBuf { /// big: KBox<[u8; 1024 * 1024 * 1024]>, @@ -761,7 +761,7 @@ macro_rules! try_init { /// # Example /// /// This will succeed: -/// ``` +/// ```ignore /// use kernel::assert_pinned; /// #[pin_data] /// struct MyStruct { @@ -787,7 +787,7 @@ macro_rules! try_init { /// Some uses of the macro may trigger the `can't use generic parameters from outer item` error. To /// work around this, you may pass the `inline` parameter to the macro. The `inline` parameter can /// only be used when the macro is invoked from a function body. -/// ``` +/// ```ignore /// use kernel::assert_pinned; /// #[pin_data] /// struct Foo { @@ -865,7 +865,7 @@ pub unsafe trait PinInit: Sized { /// /// # Examples /// - /// ```rust + /// ```rust,ignore /// # #![expect(clippy::disallowed_names)] /// use kernel::{types::Opaque, init::pin_init_from_closure}; /// #[repr(C)] @@ -977,7 +977,7 @@ pub unsafe trait Init: PinInit { /// /// # Examples /// - /// ```rust + /// ```rust,ignore /// # #![expect(clippy::disallowed_names)] /// use kernel::{types::Opaque, init::{self, init_from_closure}}; /// struct Foo { @@ -1089,7 +1089,7 @@ pub fn uninit() -> impl Init, E> { /// /// # Examples /// -/// ```rust +/// ```rust,ignore /// use kernel::{alloc::KBox, error::Error, init::init_array_from_fn}; /// let array: KBox<[usize; 1_000]> = /// KBox::init::(init_array_from_fn(|i| i), GFP_KERNEL)?; @@ -1134,7 +1134,7 @@ where /// /// # Examples /// -/// ```rust +/// ```rust,ignore /// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex}; /// let array: Arc<[Mutex; 1_000]> = /// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL)?; @@ -1323,7 +1323,7 @@ impl InPlaceWrite for UniqueArc> { /// /// Use [`pinned_drop`] to implement this trait safely: /// -/// ```rust +/// ```rust,ignore /// # use kernel::sync::Mutex; /// use kernel::macros::pinned_drop; /// use core::pin::Pin; diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs index 8c7b786377ee..0bd97c3a4e30 100644 --- a/rust/macros/lib.rs +++ b/rust/macros/lib.rs @@ -272,7 +272,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream { /// /// # Examples /// -/// ``` +/// ```ignore /// # #![feature(lint_reasons)] /// # use kernel::prelude::*; /// # use std::{sync::Mutex, process::Command}; @@ -285,7 +285,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream { /// } /// ``` /// -/// ``` +/// ```ignore /// # #![feature(lint_reasons)] /// # use kernel::prelude::*; /// # use std::{sync::Mutex, process::Command}; @@ -326,7 +326,7 @@ pub fn pin_data(inner: TokenStream, item: TokenStream) -> TokenStream { /// /// # Examples /// -/// ``` +/// ```ignore /// # #![feature(lint_reasons)] /// # use kernel::prelude::*; /// # use macros::{pin_data, pinned_drop}; @@ -502,7 +502,7 @@ pub fn paste(input: TokenStream) -> TokenStream { /// /// # Examples /// -/// ``` +/// ```ignore /// use kernel::macros::Zeroable; /// /// #[derive(Zeroable)]