Skip to content

Commit 206dea3

Browse files
y86-devojeda
authored andcommitted
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 <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent dc60dd0 commit 206dea3

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

rust/kernel/init.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//! [`pin_init!`]. The syntax is almost the same as normal `struct` initializers. The difference is
3535
//! that you need to write `<-` instead of `:` for fields that you want to initialize in-place.
3636
//!
37-
//! ```rust
37+
//! ```rust,ignore
3838
//! # #![expect(clippy::disallowed_names)]
3939
//! use kernel::sync::{new_mutex, Mutex};
4040
//! # use core::pin::Pin;
@@ -54,7 +54,7 @@
5454
//! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
5555
//! (or just the stack) to actually initialize a `Foo`:
5656
//!
57-
//! ```rust
57+
//! ```rust,ignore
5858
//! # #![expect(clippy::disallowed_names)]
5959
//! # use kernel::sync::{new_mutex, Mutex};
6060
//! # use core::pin::Pin;
@@ -78,15 +78,15 @@
7878
//! Many types from the kernel supply a function/macro that returns an initializer, because the
7979
//! above method only works for types where you can access the fields.
8080
//!
81-
//! ```rust
81+
//! ```rust,ignore
8282
//! # use kernel::sync::{new_mutex, Arc, Mutex};
8383
//! let mtx: Result<Arc<Mutex<usize>>> =
8484
//! Arc::pin_init(new_mutex!(42, "example::mtx"), GFP_KERNEL);
8585
//! ```
8686
//!
8787
//! To declare an init macro/function you just return an [`impl PinInit<T, E>`]:
8888
//!
89-
//! ```rust
89+
//! ```rust,ignore
9090
//! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init};
9191
//! #[pin_data]
9292
//! struct DriverData {
@@ -119,7 +119,7 @@
119119
//! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of
120120
//! `slot` gets called.
121121
//!
122-
//! ```rust
122+
//! ```rust,ignore
123123
//! # #![expect(unreachable_pub, clippy::disallowed_names)]
124124
//! use kernel::{init, types::Opaque};
125125
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
@@ -236,7 +236,7 @@ pub mod macros;
236236
///
237237
/// # Examples
238238
///
239-
/// ```rust
239+
/// ```rust,ignore
240240
/// # #![expect(clippy::disallowed_names)]
241241
/// # use kernel::{init, macros::pin_data, pin_init, stack_pin_init, init::*, sync::Mutex, new_mutex};
242242
/// # use core::pin::Pin;
@@ -382,7 +382,7 @@ macro_rules! stack_try_pin_init {
382382
///
383383
/// The syntax is almost identical to that of a normal `struct` initializer:
384384
///
385-
/// ```rust
385+
/// ```rust,ignore
386386
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
387387
/// # use core::pin::Pin;
388388
/// #[pin_data]
@@ -426,7 +426,7 @@ macro_rules! stack_try_pin_init {
426426
///
427427
/// To create an initializer function, simply declare it like this:
428428
///
429-
/// ```rust
429+
/// ```rust,ignore
430430
/// # use kernel::{init, pin_init, init::*};
431431
/// # use core::pin::Pin;
432432
/// # #[pin_data]
@@ -452,7 +452,7 @@ macro_rules! stack_try_pin_init {
452452
///
453453
/// Users of `Foo` can now create it like this:
454454
///
455-
/// ```rust
455+
/// ```rust,ignore
456456
/// # #![expect(clippy::disallowed_names)]
457457
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
458458
/// # use core::pin::Pin;
@@ -480,7 +480,7 @@ macro_rules! stack_try_pin_init {
480480
///
481481
/// They can also easily embed it into their own `struct`s:
482482
///
483-
/// ```rust
483+
/// ```rust,ignore
484484
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
485485
/// # use core::pin::Pin;
486486
/// # #[pin_data]
@@ -539,7 +539,7 @@ macro_rules! stack_try_pin_init {
539539
///
540540
/// For instance:
541541
///
542-
/// ```rust
542+
/// ```rust,ignore
543543
/// # use kernel::{macros::{Zeroable, pin_data}, pin_init};
544544
/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
545545
/// #[pin_data]
@@ -602,7 +602,7 @@ macro_rules! pin_init {
602602
///
603603
/// # Examples
604604
///
605-
/// ```rust
605+
/// ```rust,ignore
606606
/// use kernel::{init::{self, PinInit}, error::Error};
607607
/// #[pin_data]
608608
/// struct BigBuf {
@@ -705,7 +705,7 @@ macro_rules! init {
705705
///
706706
/// # Examples
707707
///
708-
/// ```rust
708+
/// ```rust,ignore
709709
/// use kernel::{alloc::KBox, init::{PinInit, zeroed}, error::Error};
710710
/// struct BigBuf {
711711
/// big: KBox<[u8; 1024 * 1024 * 1024]>,
@@ -761,7 +761,7 @@ macro_rules! try_init {
761761
/// # Example
762762
///
763763
/// This will succeed:
764-
/// ```
764+
/// ```ignore
765765
/// use kernel::assert_pinned;
766766
/// #[pin_data]
767767
/// struct MyStruct {
@@ -787,7 +787,7 @@ macro_rules! try_init {
787787
/// Some uses of the macro may trigger the `can't use generic parameters from outer item` error. To
788788
/// work around this, you may pass the `inline` parameter to the macro. The `inline` parameter can
789789
/// only be used when the macro is invoked from a function body.
790-
/// ```
790+
/// ```ignore
791791
/// use kernel::assert_pinned;
792792
/// #[pin_data]
793793
/// struct Foo<T> {
@@ -865,7 +865,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
865865
///
866866
/// # Examples
867867
///
868-
/// ```rust
868+
/// ```rust,ignore
869869
/// # #![expect(clippy::disallowed_names)]
870870
/// use kernel::{types::Opaque, init::pin_init_from_closure};
871871
/// #[repr(C)]
@@ -977,7 +977,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
977977
///
978978
/// # Examples
979979
///
980-
/// ```rust
980+
/// ```rust,ignore
981981
/// # #![expect(clippy::disallowed_names)]
982982
/// use kernel::{types::Opaque, init::{self, init_from_closure}};
983983
/// struct Foo {
@@ -1089,7 +1089,7 @@ pub fn uninit<T, E>() -> impl Init<MaybeUninit<T>, E> {
10891089
///
10901090
/// # Examples
10911091
///
1092-
/// ```rust
1092+
/// ```rust,ignore
10931093
/// use kernel::{alloc::KBox, error::Error, init::init_array_from_fn};
10941094
/// let array: KBox<[usize; 1_000]> =
10951095
/// KBox::init::<Error>(init_array_from_fn(|i| i), GFP_KERNEL)?;
@@ -1134,7 +1134,7 @@ where
11341134
///
11351135
/// # Examples
11361136
///
1137-
/// ```rust
1137+
/// ```rust,ignore
11381138
/// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex};
11391139
/// let array: Arc<[Mutex<usize>; 1_000]> =
11401140
/// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL)?;
@@ -1323,7 +1323,7 @@ impl<T> InPlaceWrite<T> for UniqueArc<MaybeUninit<T>> {
13231323
///
13241324
/// Use [`pinned_drop`] to implement this trait safely:
13251325
///
1326-
/// ```rust
1326+
/// ```rust,ignore
13271327
/// # use kernel::sync::Mutex;
13281328
/// use kernel::macros::pinned_drop;
13291329
/// use core::pin::Pin;

rust/macros/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
272272
///
273273
/// # Examples
274274
///
275-
/// ```
275+
/// ```ignore
276276
/// # #![feature(lint_reasons)]
277277
/// # use kernel::prelude::*;
278278
/// # use std::{sync::Mutex, process::Command};
@@ -285,7 +285,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
285285
/// }
286286
/// ```
287287
///
288-
/// ```
288+
/// ```ignore
289289
/// # #![feature(lint_reasons)]
290290
/// # use kernel::prelude::*;
291291
/// # use std::{sync::Mutex, process::Command};
@@ -326,7 +326,7 @@ pub fn pin_data(inner: TokenStream, item: TokenStream) -> TokenStream {
326326
///
327327
/// # Examples
328328
///
329-
/// ```
329+
/// ```ignore
330330
/// # #![feature(lint_reasons)]
331331
/// # use kernel::prelude::*;
332332
/// # use macros::{pin_data, pinned_drop};
@@ -502,7 +502,7 @@ pub fn paste(input: TokenStream) -> TokenStream {
502502
///
503503
/// # Examples
504504
///
505-
/// ```
505+
/// ```ignore
506506
/// use kernel::macros::Zeroable;
507507
///
508508
/// #[derive(Zeroable)]

0 commit comments

Comments
 (0)