[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aS3seTNRum3ZXMom@yury>
Date: Mon, 1 Dec 2025 14:28:57 -0500
From: Yury Norov <yury.norov@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Burak Emir <bqe@...gle.com>,
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>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH] rust: id_pool: fix example
On Mon, Dec 01, 2025 at 01:09:49AM +0100, Miguel Ojeda wrote:
> When building with KUnit doctests enabled, `rustc` reports:
>
> error[E0599]: no method named `acquire_next_id` found for struct `IdPool` in the current scope
> --> rust/doctests_kernel_generated.rs:6722:24
> |
> 6722 | assert_eq!(i, pool.acquire_next_id(i).ok_or(ENOSPC)?);
> | ^^^^^^^^^^^^^^^ method not found in `IdPool`
>
> Thus fix it.
>
> Fixes: a5726454470c ("rust: id_pool: do not immediately acquire new ids")
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
Thanks Miguel,
I applied this, but the fact that you've sent a second fix to
documentation that actually is a build fix, raises the questions.
Because Rust documentation bears compilable chunks of code, I think
we need to enable rustdoc tests target by default, so that developers
will not send broken tests.
Thanks,
Yury
> ---
> I saw this in -next.
>
> rust/kernel/id_pool.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/kernel/id_pool.rs b/rust/kernel/id_pool.rs
> index 73a952d7dd83..384753fe0e44 100644
> --- a/rust/kernel/id_pool.rs
> +++ b/rust/kernel/id_pool.rs
> @@ -28,7 +28,7 @@
> ///
> /// let mut pool = IdPool::with_capacity(64, GFP_KERNEL)?;
> /// for i in 0..64 {
> -/// assert_eq!(i, pool.acquire_next_id(i).ok_or(ENOSPC)?);
> +/// assert_eq!(i, pool.find_unused_id(i).ok_or(ENOSPC)?.acquire());
> /// }
> ///
> /// pool.release_id(23);
>
> base-commit: 00c5ce039598e692e1dd4bf2b3ad5bc08bdf3270
> --
> 2.52.0
Powered by blists - more mailing lists