[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250304225245.2033120-22-benno.lossin@proton.me>
Date: Tue, 04 Mar 2025 22:56:18 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Benno Lossin <benno.lossin@...ton.me>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 21/22] rust: pin-init: re-enable doctests
The pin-init crate is now compiled in a standalone fashion, so revert
the earlier commit that disabled the doctests in pin-init in order to
avoid build errors while transitioning the crate into a standalone
version.
Signed-off-by: Benno Lossin <benno.lossin@...ton.me>
---
rust/pin-init/src/lib.rs | 54 ++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index 3d57760a3cee..cb015b118283 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -63,7 +63,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,ignore
+//! ```rust
//! # #![expect(clippy::disallowed_names)]
//! # #![feature(allocator_api)]
//! # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
@@ -87,7 +87,7 @@
//! `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`:
//!
-//! ```rust,ignore
+//! ```rust
//! # #![expect(clippy::disallowed_names)]
//! # #![feature(allocator_api)]
//! # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
@@ -115,7 +115,7 @@
//! Many types that use this library supply a function/macro that returns an initializer, because
//! the above method only works for types where you can access the fields.
//!
-//! ```rust,ignore
+//! ```rust
//! # #![feature(allocator_api)]
//! # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
//! # use pin_init::*;
@@ -126,7 +126,7 @@
//!
//! To declare an init macro/function you just return an [`impl PinInit<T, E>`]:
//!
-//! ```rust,ignore
+//! ```rust
//! # #![feature(allocator_api)]
//! # use pin_init::*;
//! # #[path = "../examples/error.rs"] mod error; use error::Error;
@@ -162,7 +162,7 @@
//! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of
//! `slot` gets called.
//!
-//! ```rust,ignore
+//! ```rust
//! # #![feature(extern_types)]
//! use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure};
//! use core::{
@@ -298,7 +298,7 @@
///
/// # Examples
///
-/// ```ignore
+/// ```
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
/// use pin_init::pin_data;
@@ -315,7 +315,7 @@
/// }
/// ```
///
-/// ```ignore
+/// ```
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
/// # mod bindings { pub struct info; pub unsafe fn destroy_info(_: *mut info) {} }
@@ -349,7 +349,7 @@
///
/// # Examples
///
-/// ```ignore
+/// ```
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
/// # mod bindings { pub struct info; pub unsafe fn destroy_info(_: *mut info) {} }
@@ -383,7 +383,7 @@
///
/// # Examples
///
-/// ```ignore
+/// ```
/// use pin_init::Zeroable;
///
/// #[derive(Zeroable)]
@@ -399,7 +399,7 @@
///
/// # Examples
///
-/// ```rust,ignore
+/// ```rust
/// # #![expect(clippy::disallowed_names)]
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
@@ -451,7 +451,7 @@ macro_rules! stack_pin_init {
///
/// # Examples
///
-/// ```rust,ignore
+/// ```rust
/// # #![expect(clippy::disallowed_names)]
/// # #![feature(allocator_api)]
/// # #[path = "../examples/error.rs"] mod error; use error::Error;
@@ -478,7 +478,7 @@ macro_rules! stack_pin_init {
/// println!("a: {}", &*foo.a.lock());
/// ```
///
-/// ```rust,ignore
+/// ```rust
/// # #![expect(clippy::disallowed_names)]
/// # #![feature(allocator_api)]
/// # #[path = "../examples/error.rs"] mod error; use error::Error;
@@ -531,7 +531,7 @@ macro_rules! stack_try_pin_init {
///
/// The syntax is almost identical to that of a normal `struct` initializer:
///
-/// ```rust,ignore
+/// ```rust
/// # use pin_init::*;
/// # use core::pin::Pin;
/// #[pin_data]
@@ -575,7 +575,7 @@ macro_rules! stack_try_pin_init {
///
/// To create an initializer function, simply declare it like this:
///
-/// ```rust,ignore
+/// ```rust
/// # use pin_init::*;
/// # use core::pin::Pin;
/// # #[pin_data]
@@ -601,7 +601,7 @@ macro_rules! stack_try_pin_init {
///
/// Users of `Foo` can now create it like this:
///
-/// ```rust,ignore
+/// ```rust
/// # #![expect(clippy::disallowed_names)]
/// # use pin_init::*;
/// # use core::pin::Pin;
@@ -629,7 +629,7 @@ macro_rules! stack_try_pin_init {
///
/// They can also easily embed it into their own `struct`s:
///
-/// ```rust,ignore
+/// ```rust
/// # use pin_init::*;
/// # use core::pin::Pin;
/// # #[pin_data]
@@ -688,7 +688,7 @@ macro_rules! stack_try_pin_init {
///
/// For instance:
///
-/// ```rust,ignore
+/// ```rust
/// # use pin_init::*;
/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
/// #[pin_data]
@@ -742,7 +742,7 @@ macro_rules! pin_init {
///
/// # Examples
///
-/// ```rust,ignore
+/// ```rust
/// # #![feature(allocator_api)]
/// # #[path = "../examples/error.rs"] mod error; use error::Error;
/// use pin_init::{pin_data, try_pin_init, PinInit, InPlaceInit, zeroed};
@@ -849,7 +849,7 @@ macro_rules! init {
///
/// # Examples
///
-/// ```rust,ignore
+/// ```rust
/// # #![feature(allocator_api)]
/// # use core::alloc::AllocError;
/// # use pin_init::InPlaceInit;
@@ -896,7 +896,7 @@ macro_rules! try_init {
/// # Example
///
/// This will succeed:
-/// ```ignore
+/// ```
/// use pin_init::{pin_data, assert_pinned};
///
/// #[pin_data]
@@ -909,7 +909,7 @@ macro_rules! try_init {
/// ```
///
/// This will fail:
-/// ```compile_fail,ignore
+/// ```compile_fail
/// use pin_init::{pin_data, assert_pinned};
///
/// #[pin_data]
@@ -923,7 +923,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 core::pin::Pin;
/// use pin_init::{pin_data, assert_pinned};
///
@@ -1002,7 +1002,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
///
/// # Examples
///
- /// ```rust,ignore
+ /// ```rust
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
/// # use pin_init::*;
@@ -1092,7 +1092,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
///
/// # Examples
///
- /// ```rust,ignore
+ /// ```rust
/// # #![expect(clippy::disallowed_names)]
/// use pin_init::{init, zeroed, Init};
///
@@ -1205,7 +1205,7 @@ pub fn uninit<T, E>() -> impl Init<MaybeUninit<T>, E> {
///
/// # Examples
///
-/// ```rust,ignore
+/// ```rust
/// # use pin_init::*;
/// use pin_init::init_array_from_fn;
/// let array: Box<[usize; 1_000]> = Box::init(init_array_from_fn(|i| i)).unwrap();
@@ -1243,7 +1243,7 @@ pub fn init_array_from_fn<I, const N: usize, T, E>(
///
/// # Examples
///
-/// ```rust,ignore
+/// ```rust
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
/// # use pin_init::*;
@@ -1319,7 +1319,7 @@ pub trait InPlaceWrite<T> {
///
/// Use [`pinned_drop`] to implement this trait safely:
///
-/// ```rust,ignore
+/// ```rust
/// # #![feature(allocator_api)]
/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
/// # use pin_init::*;
--
2.47.2
Powered by blists - more mailing lists