mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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 <benno.lossin@proton.me> Reviewed-by: Fiona Behrens <me@kloenk.dev> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Tested-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250308110339.2997091-2-benno.lossin@proton.me Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
		
							parent
							
								
									dc60dd0c68
								
							
						
					
					
						commit
						206dea39e5
					
				
					 2 changed files with 24 additions and 24 deletions
				
			
		| 
						 | 
					@ -34,7 +34,7 @@
 | 
				
			||||||
//! [`pin_init!`]. The syntax is almost the same as normal `struct` initializers. The difference is
 | 
					//! [`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.
 | 
					//! that you need to write `<-` instead of `:` for fields that you want to initialize in-place.
 | 
				
			||||||
//!
 | 
					//!
 | 
				
			||||||
//! ```rust
 | 
					//! ```rust,ignore
 | 
				
			||||||
//! # #![expect(clippy::disallowed_names)]
 | 
					//! # #![expect(clippy::disallowed_names)]
 | 
				
			||||||
//! use kernel::sync::{new_mutex, Mutex};
 | 
					//! use kernel::sync::{new_mutex, Mutex};
 | 
				
			||||||
//! # use core::pin::Pin;
 | 
					//! # use core::pin::Pin;
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@
 | 
				
			||||||
//! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
 | 
					//! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
 | 
				
			||||||
//! (or just the stack) to actually initialize a `Foo`:
 | 
					//! (or just the stack) to actually initialize a `Foo`:
 | 
				
			||||||
//!
 | 
					//!
 | 
				
			||||||
//! ```rust
 | 
					//! ```rust,ignore
 | 
				
			||||||
//! # #![expect(clippy::disallowed_names)]
 | 
					//! # #![expect(clippy::disallowed_names)]
 | 
				
			||||||
//! # use kernel::sync::{new_mutex, Mutex};
 | 
					//! # use kernel::sync::{new_mutex, Mutex};
 | 
				
			||||||
//! # use core::pin::Pin;
 | 
					//! # use core::pin::Pin;
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@
 | 
				
			||||||
//! Many types from the kernel supply a function/macro that returns an initializer, because the
 | 
					//! 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.
 | 
					//! above method only works for types where you can access the fields.
 | 
				
			||||||
//!
 | 
					//!
 | 
				
			||||||
//! ```rust
 | 
					//! ```rust,ignore
 | 
				
			||||||
//! # use kernel::sync::{new_mutex, Arc, Mutex};
 | 
					//! # use kernel::sync::{new_mutex, Arc, Mutex};
 | 
				
			||||||
//! let mtx: Result<Arc<Mutex<usize>>> =
 | 
					//! let mtx: Result<Arc<Mutex<usize>>> =
 | 
				
			||||||
//!     Arc::pin_init(new_mutex!(42, "example::mtx"), GFP_KERNEL);
 | 
					//!     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<T, E>`]:
 | 
					//! To declare an init macro/function you just return an [`impl PinInit<T, E>`]:
 | 
				
			||||||
//!
 | 
					//!
 | 
				
			||||||
//! ```rust
 | 
					//! ```rust,ignore
 | 
				
			||||||
//! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init};
 | 
					//! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init};
 | 
				
			||||||
//! #[pin_data]
 | 
					//! #[pin_data]
 | 
				
			||||||
//! struct DriverData {
 | 
					//! struct DriverData {
 | 
				
			||||||
| 
						 | 
					@ -119,7 +119,7 @@
 | 
				
			||||||
//! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of
 | 
					//! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of
 | 
				
			||||||
//!   `slot` gets called.
 | 
					//!   `slot` gets called.
 | 
				
			||||||
//!
 | 
					//!
 | 
				
			||||||
//! ```rust
 | 
					//! ```rust,ignore
 | 
				
			||||||
//! # #![expect(unreachable_pub, clippy::disallowed_names)]
 | 
					//! # #![expect(unreachable_pub, clippy::disallowed_names)]
 | 
				
			||||||
//! use kernel::{init, types::Opaque};
 | 
					//! use kernel::{init, types::Opaque};
 | 
				
			||||||
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
 | 
					//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
 | 
				
			||||||
| 
						 | 
					@ -236,7 +236,7 @@
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// # #![expect(clippy::disallowed_names)]
 | 
					/// # #![expect(clippy::disallowed_names)]
 | 
				
			||||||
/// # use kernel::{init, macros::pin_data, pin_init, stack_pin_init, init::*, sync::Mutex, new_mutex};
 | 
					/// # use kernel::{init, macros::pin_data, pin_init, stack_pin_init, init::*, sync::Mutex, new_mutex};
 | 
				
			||||||
/// # use core::pin::Pin;
 | 
					/// # 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:
 | 
					/// 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 kernel::{init, pin_init, macros::pin_data, init::*};
 | 
				
			||||||
/// # use core::pin::Pin;
 | 
					/// # use core::pin::Pin;
 | 
				
			||||||
/// #[pin_data]
 | 
					/// #[pin_data]
 | 
				
			||||||
| 
						 | 
					@ -426,7 +426,7 @@ macro_rules! stack_try_pin_init {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// To create an initializer function, simply declare it like this:
 | 
					/// To create an initializer function, simply declare it like this:
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// # use kernel::{init, pin_init, init::*};
 | 
					/// # use kernel::{init, pin_init, init::*};
 | 
				
			||||||
/// # use core::pin::Pin;
 | 
					/// # use core::pin::Pin;
 | 
				
			||||||
/// # #[pin_data]
 | 
					/// # #[pin_data]
 | 
				
			||||||
| 
						 | 
					@ -452,7 +452,7 @@ macro_rules! stack_try_pin_init {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Users of `Foo` can now create it like this:
 | 
					/// Users of `Foo` can now create it like this:
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// # #![expect(clippy::disallowed_names)]
 | 
					/// # #![expect(clippy::disallowed_names)]
 | 
				
			||||||
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
 | 
					/// # use kernel::{init, pin_init, macros::pin_data, init::*};
 | 
				
			||||||
/// # use core::pin::Pin;
 | 
					/// # 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:
 | 
					/// They can also easily embed it into their own `struct`s:
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
 | 
					/// # use kernel::{init, pin_init, macros::pin_data, init::*};
 | 
				
			||||||
/// # use core::pin::Pin;
 | 
					/// # use core::pin::Pin;
 | 
				
			||||||
/// # #[pin_data]
 | 
					/// # #[pin_data]
 | 
				
			||||||
| 
						 | 
					@ -539,7 +539,7 @@ macro_rules! stack_try_pin_init {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// For instance:
 | 
					/// For instance:
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// # use kernel::{macros::{Zeroable, pin_data}, pin_init};
 | 
					/// # use kernel::{macros::{Zeroable, pin_data}, pin_init};
 | 
				
			||||||
/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
 | 
					/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
 | 
				
			||||||
/// #[pin_data]
 | 
					/// #[pin_data]
 | 
				
			||||||
| 
						 | 
					@ -602,7 +602,7 @@ macro_rules! pin_init {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// use kernel::{init::{self, PinInit}, error::Error};
 | 
					/// use kernel::{init::{self, PinInit}, error::Error};
 | 
				
			||||||
/// #[pin_data]
 | 
					/// #[pin_data]
 | 
				
			||||||
/// struct BigBuf {
 | 
					/// struct BigBuf {
 | 
				
			||||||
| 
						 | 
					@ -705,7 +705,7 @@ macro_rules! init {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// use kernel::{alloc::KBox, init::{PinInit, zeroed}, error::Error};
 | 
					/// use kernel::{alloc::KBox, init::{PinInit, zeroed}, error::Error};
 | 
				
			||||||
/// struct BigBuf {
 | 
					/// struct BigBuf {
 | 
				
			||||||
///     big: KBox<[u8; 1024 * 1024 * 1024]>,
 | 
					///     big: KBox<[u8; 1024 * 1024 * 1024]>,
 | 
				
			||||||
| 
						 | 
					@ -761,7 +761,7 @@ macro_rules! try_init {
 | 
				
			||||||
/// # Example
 | 
					/// # Example
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// This will succeed:
 | 
					/// This will succeed:
 | 
				
			||||||
/// ```
 | 
					/// ```ignore
 | 
				
			||||||
/// use kernel::assert_pinned;
 | 
					/// use kernel::assert_pinned;
 | 
				
			||||||
/// #[pin_data]
 | 
					/// #[pin_data]
 | 
				
			||||||
/// struct MyStruct {
 | 
					/// 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
 | 
					/// 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
 | 
					/// 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.
 | 
					/// only be used when the macro is invoked from a function body.
 | 
				
			||||||
/// ```
 | 
					/// ```ignore
 | 
				
			||||||
/// use kernel::assert_pinned;
 | 
					/// use kernel::assert_pinned;
 | 
				
			||||||
/// #[pin_data]
 | 
					/// #[pin_data]
 | 
				
			||||||
/// struct Foo<T> {
 | 
					/// struct Foo<T> {
 | 
				
			||||||
| 
						 | 
					@ -865,7 +865,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// # Examples
 | 
					    /// # Examples
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// ```rust
 | 
					    /// ```rust,ignore
 | 
				
			||||||
    /// # #![expect(clippy::disallowed_names)]
 | 
					    /// # #![expect(clippy::disallowed_names)]
 | 
				
			||||||
    /// use kernel::{types::Opaque, init::pin_init_from_closure};
 | 
					    /// use kernel::{types::Opaque, init::pin_init_from_closure};
 | 
				
			||||||
    /// #[repr(C)]
 | 
					    /// #[repr(C)]
 | 
				
			||||||
| 
						 | 
					@ -977,7 +977,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// # Examples
 | 
					    /// # Examples
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// ```rust
 | 
					    /// ```rust,ignore
 | 
				
			||||||
    /// # #![expect(clippy::disallowed_names)]
 | 
					    /// # #![expect(clippy::disallowed_names)]
 | 
				
			||||||
    /// use kernel::{types::Opaque, init::{self, init_from_closure}};
 | 
					    /// use kernel::{types::Opaque, init::{self, init_from_closure}};
 | 
				
			||||||
    /// struct Foo {
 | 
					    /// struct Foo {
 | 
				
			||||||
| 
						 | 
					@ -1089,7 +1089,7 @@ pub fn uninit<T, E>() -> impl Init<MaybeUninit<T>, E> {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// use kernel::{alloc::KBox, error::Error, init::init_array_from_fn};
 | 
					/// use kernel::{alloc::KBox, error::Error, init::init_array_from_fn};
 | 
				
			||||||
/// let array: KBox<[usize; 1_000]> =
 | 
					/// let array: KBox<[usize; 1_000]> =
 | 
				
			||||||
///     KBox::init::<Error>(init_array_from_fn(|i| i), GFP_KERNEL)?;
 | 
					///     KBox::init::<Error>(init_array_from_fn(|i| i), GFP_KERNEL)?;
 | 
				
			||||||
| 
						 | 
					@ -1134,7 +1134,7 @@ pub fn init_array_from_fn<I, const N: usize, T, E>(
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex};
 | 
					/// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex};
 | 
				
			||||||
/// let array: Arc<[Mutex<usize>; 1_000]> =
 | 
					/// let array: Arc<[Mutex<usize>; 1_000]> =
 | 
				
			||||||
///     Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL)?;
 | 
					///     Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL)?;
 | 
				
			||||||
| 
						 | 
					@ -1323,7 +1323,7 @@ fn write_pin_init<E>(mut self, init: impl PinInit<T, E>) -> Result<Pin<Self::Ini
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Use [`pinned_drop`] to implement this trait safely:
 | 
					/// Use [`pinned_drop`] to implement this trait safely:
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```rust
 | 
					/// ```rust,ignore
 | 
				
			||||||
/// # use kernel::sync::Mutex;
 | 
					/// # use kernel::sync::Mutex;
 | 
				
			||||||
/// use kernel::macros::pinned_drop;
 | 
					/// use kernel::macros::pinned_drop;
 | 
				
			||||||
/// use core::pin::Pin;
 | 
					/// use core::pin::Pin;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -272,7 +272,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```
 | 
					/// ```ignore
 | 
				
			||||||
/// # #![feature(lint_reasons)]
 | 
					/// # #![feature(lint_reasons)]
 | 
				
			||||||
/// # use kernel::prelude::*;
 | 
					/// # use kernel::prelude::*;
 | 
				
			||||||
/// # use std::{sync::Mutex, process::Command};
 | 
					/// # use std::{sync::Mutex, process::Command};
 | 
				
			||||||
| 
						 | 
					@ -285,7 +285,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
 | 
				
			||||||
/// }
 | 
					/// }
 | 
				
			||||||
/// ```
 | 
					/// ```
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```
 | 
					/// ```ignore
 | 
				
			||||||
/// # #![feature(lint_reasons)]
 | 
					/// # #![feature(lint_reasons)]
 | 
				
			||||||
/// # use kernel::prelude::*;
 | 
					/// # use kernel::prelude::*;
 | 
				
			||||||
/// # use std::{sync::Mutex, process::Command};
 | 
					/// # use std::{sync::Mutex, process::Command};
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,7 @@ pub fn pin_data(inner: TokenStream, item: TokenStream) -> TokenStream {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```
 | 
					/// ```ignore
 | 
				
			||||||
/// # #![feature(lint_reasons)]
 | 
					/// # #![feature(lint_reasons)]
 | 
				
			||||||
/// # use kernel::prelude::*;
 | 
					/// # use kernel::prelude::*;
 | 
				
			||||||
/// # use macros::{pin_data, pinned_drop};
 | 
					/// # use macros::{pin_data, pinned_drop};
 | 
				
			||||||
| 
						 | 
					@ -502,7 +502,7 @@ pub fn paste(input: TokenStream) -> TokenStream {
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// # Examples
 | 
					/// # Examples
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// ```
 | 
					/// ```ignore
 | 
				
			||||||
/// use kernel::macros::Zeroable;
 | 
					/// use kernel::macros::Zeroable;
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// #[derive(Zeroable)]
 | 
					/// #[derive(Zeroable)]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue