From: Yury Norov <yury.norov@gmail.com>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
"Burak Emir" <bqe@google.com>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@lists.linux.dev
Subject: Re: [PATCH] rust: id_pool: fix example
Date: Mon, 1 Dec 2025 14:28:57 -0500 [thread overview]
Message-ID: <aS3seTNRum3ZXMom@yury> (raw)
In-Reply-To: <20251201000949.1626363-1-ojeda@kernel.org>
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@kernel.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
next prev parent reply other threads:[~2025-12-01 19:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 0:09 [PATCH] rust: id_pool: fix example Miguel Ojeda
2025-12-01 10:07 ` Alice Ryhl
2025-12-01 19:28 ` Yury Norov [this message]
2025-12-01 23:13 ` Miguel Ojeda
2025-12-02 12:22 ` Alice Ryhl
2025-12-02 18:33 ` Yury Norov
2026-01-06 9:46 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aS3seTNRum3ZXMom@yury \
--to=yury.norov@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=bqe@google.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=patches@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.